Details
-
Bug
-
Resolution: Fixed
-
Major
-
7.0.4, 7.1.1
-
Untriaged
-
1
-
Yes
Description
Steps to repro:
1. spin up 7.1.1-3175 node with kv, index and n1ql services (note: strictly speaking index service not required as no indexes are created for this repro)
2. create bucket test
3. in _default scope, create collection collection0
4. create function udf1 :
CREATE OR REPLACE FUNCTION udf1(param) {(
|
SELECT 1
|
FROM param AS collection0
|
JOIN collection1 AS c1
|
ON META(c1).id = collection0.field0
|
)};
|
5. set query context in UI to test/_default. run udf1 and it fails:
execute function udf1([]);
|
[
|
{
|
"code": 5370,
|
"msg": "Unable to run subquery - cause: No secondary index available for keyspace c1 in correlated subquery.",
|
"query": "execute function udf1([]);"
|
},
|
{
|
"code": 10109,
|
"msg": "Error executing function 'udf1' ",
|
"reason": {
|
"caller": "context:900",
|
"code": 5370,
|
"icause": "No secondary index available for keyspace c1 in correlated subquery.",
|
"key": "execution.subquery.build",
|
"message": "Unable to run subquery"
|
}
|
}
|
]
|
Workaround:
Use lookup join instead. For example:
CREATE OR REPLACE FUNCTION udf2(param) {(
|
SELECT 1
|
FROM param AS collection0
|
JOIN collection1 AS c1
|
ON KEYS collection0.field0
|
)};
|
execute function udf2([]); // success
|