-
Notifications
You must be signed in to change notification settings - Fork 7
All array element accessors require non-array items to be wrapped #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Main TODO - indexed arrays [1,4, 6 to 18] - variables execution ( $varname ) - function support - ariphmetic support - correct error support It provides two debugging functions: _jsonpath_object and _jsonpath_exist Some examples are avaliable in src/test/regress/sql/sql_json.sql
…rasion ops for sequences
Both SELECT JSON_QUERY(jsonb '{}', '{"a":"b"}[*]'); and SELECT JSON_QUERY(jsonb '{}', '{}["bread"]'); should return values (the latter query should return a null value);
This is a separate pull request, because I discovered this issue the next day I created PR #3. I didn't unify the two commits by creating a new PR, because this change could use some discussion. My main concern is that '{}["bread"]'::jsonpath is allowed at the parsing level. The technical report I'm using to learn the SQL/JSON path language specifically says:
and specifically forbids strings:
On the other hand, the BNF they give just above the paragraph I selectively quoted says that JSON array accessor is a bracketed JSON subscript list which if a list of JSON path wff - and JSON path wff appears to be the entire language specification, excluding the mode name. Even if you decide to allow strings to be elements of array subscripts, I'm not sure why unquoted character sequences like in the following example are allowed: |
I agree that unquoted string literals should not be allowed in jsonpath grammar. Now they are not distinguished from quoted literals in grammar, so I'll have to fix this issue. Object subscripting with string subscripts is our extension (see commit 63113dc where processing of Here are examples showing differences in behavior between lax and strict mode:
|
I meant PR #2 there.
I see. This should be documented somewhere. I guess this PR boils down to " |
Both SELECT JSON_QUERY(jsonb '{}', '{"a":"b"}[*]'); and SELECT JSON_QUERY(jsonb '{}', '{}["bread"]'); should return values (the latter query should return a null value).