From: | Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com> |
---|---|
To: | Himanshu Upadhyaya <upadhyaya(dot)himanshu(at)gmail(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net> |
Cc: | Nikita Glukhov <n(dot)gluhov(at)postgrespro(dot)ru>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Dmitry Dolgov <9erthalion6(at)gmail(dot)com>, Oleg Bartunov <obartunov(at)postgrespro(dot)ru>, Erik Rijkers <er(at)xs4all(dot)nl> |
Subject: | Re: SQL/JSON: functions |
Date: | 2021-12-09 15:08:50 |
Message-ID: | 171c5a4c-79b0-dc67-97eb-19aae1514cf4@enterprisedb.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 09.12.21 15:04, Himanshu Upadhyaya wrote:
> 1)
> Why we don't support KEY(however is optional as per SQL standard) keyword?
> SELECT JSON_OBJECT(KEY 'a' VALUE '123');
> ERROR: type "key" does not exist
> LINE 1: SELECT JSON_OBJECT(KEY 'a' VALUE '123');
>
> ORACLE is supporting the above syntax.
>
> I can see TODO as below
> +json_name_and_value:
> +/* TODO This is not supported due to conflicts
> + KEY c_expr VALUE_P json_value_expr %prec POSTFIXOP
> + { $$ = makeJsonKeyValue($2, $4); }
> + |
> +*/
>
> but still not very clear what kind of conflict we are mentioning here,
> also any plan of finding a solution to that conflict?
The conflict is this:
Consider in subclause 6.33, “<JSON value constructor>”:
<JSON name and value> ::= [ KEY ] <JSON name> VALUE <JSON input expression>
| ...
Because KEY is a <non-reserved word>, this creates an ambiguity. For
example:
key(x) VALUE foo
could be
KEY x VALUE foo
with KEY being the key word and “x” (a <column reference>) as “<JSON
name>”, or
KEY key(x) VALUE foo
with “key(x)” (a <routine invocation>) as “<JSON name>”.
In existing implementations, KEY is resolved as a keyword. So if you
can figure out a way to implement that, go ahead, but I imagine it might
be tricky.
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2021-12-09 15:24:23 | Re: Post-CVE Wishlist |
Previous Message | Andrew Dunstan | 2021-12-09 14:42:19 | Re: port conflicts when running tests concurrently on windows. |