You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
No function matches the given name and argument types 'json_extract(JSON, BOOLEAN)' #10786
When using json_extract on a json field with only 0 or 1 values:
Error: Binder Error: No function matches the given name and argument types 'json_extract(JSON, BOOLEAN)'. You might need to add explicit type casts.
Candidate functions:
json_extract(VARCHAR, BIGINT) -> JSON
json_extract(VARCHAR, VARCHAR) -> JSON
json_extract(VARCHAR, VARCHAR[]) -> JSON[]
json_extract(JSON, BIGINT) -> JSON
json_extract(JSON, VARCHAR) -> JSON
json_extract(JSON, VARCHAR[]) -> JSON[]
To Reproduce
CREATE TEMPORARY TABLE TBL (COL JSON);
INSERT INTO TBL (COL) SELECT (TO_JSON({'K1': {'K2': 1}}));
SELECT COL FROM TBL WHERE COL ->'$.K1'->'$.K2'>0;
Activity
Mause commentedon Feb 21, 2024
Looks like this is a case of
>having a higher precedence than->?This seems to work fine:
chanon commentedon Feb 22, 2024
Same issue seems to happen with
=and other operatorseg.
and
result in the same error
hannes commentedon Feb 26, 2024
There is a precedence conflict here, for lambdas we want
=to have higher precedence than->:But for JSON we want
->to have higher precedence than=:As such there is no good solution here - so parenthesis are just going to be required here. We'll add a note to the documentation.