Re: SQL/JSON revisited
Peter Eisentraut <peter.eisentraut@enterprisedb.com>
From: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
To: Alvaro Herrera <alvherre@alvh.no-ip.org>,
Andrew Dunstan <andrew@dunslane.net>
Cc: Amit Langote <amitlangote09@gmail.com>, Andres Freund
<andres@anarazel.de>, vignesh C <vignesh21@gmail.com>,
PostgreSQL-development <pgsql-hackers@postgresql.org>,
e.indrupskaya@postgrespro.ru
Date: 2023-03-28T06:07:23Z
Lists: pgsql-hackers
On 27.03.23 20:54, Alvaro Herrera wrote:
> Even so, I was unable to get bison
> to accept the 'KEY name VALUES blah' syntax; it might be a
> fun/challenging project to change the productions that we use for JSON
> names and values:
>
> +json_name_and_value:
> +/* Supporting this syntax seems to require major surgery
> + KEY c_expr VALUE_P json_value_expr
> + { $$ = makeJsonKeyValue($2, $4); }
> + |
> +*/
> + c_expr VALUE_P json_value_expr
> + { $$ = makeJsonKeyValue($1, $3); }
> + |
> + a_expr ':' json_value_expr
> + { $$ = makeJsonKeyValue($1, $3); }
> + ;
>
> If we uncomment the KEY bit there, a bunch of conflicts emerge.
This is a known bug in the SQL standard. Because KEY is a non-reserved
keyword, writing
KEY (x) VALUE y
is ambiguous because KEY could be the keyword for this clause or a
function call key(x).
It's ok to leave it like this for now.
Commits
-
Add SQL/JSON query functions
- 6185c9737cf4 17.0 landed
-
Add soft error handling to some expression nodes
- aaaf9449ec6b 17.0 landed
-
Adjust populate_record_field() to handle errors softly
- 1edb3b491bee 17.0 landed
-
Refactor code used by jsonpath executor to fetch variables
- faa2b953ba3b 17.0 landed
-
Code review for recent SQL/JSON commits
- 71bfd1543f8b 16.0 landed
-
Fix inconsistencies and style issues in new SQL/JSON code
- 60966f56c3e4 16.0 landed
-
Don't install postmaster symlink anymore
- 37e267335068 16.0 cited
-
Revert SQL/JSON features
- 2f2b18bd3f55 16.0 cited
-
Doc: standardize markup a bit more.
- 47046763c3ed 13.0 cited