Re: SQL/JSON revisited - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: SQL/JSON revisited
Date
Msg-id 20230322121846.vcxjogqyguihkicr@alvherre.pgsql
Whole thread Raw
In response to Re: SQL/JSON revisited  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: SQL/JSON revisited  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
List pgsql-hackers
On 2023-Mar-16, Andrew Dunstan wrote:

> Hi, I have taken these and done some surgery to reduce the explosion on
> grammar symbols. The attached set is just Amit's patches with some of this
> surgery done - nothing other than gram.y has been touched. Patches 2 and 5
> in the series could be sanely squashed onto patches 1 and 4 respectively. I
> haven't done anything significant yet with the JSONTABLE patch, there is
> probably some more low hanging fruit there, and possibly some still in the
> earlier patches.

Hello,

It looks as if the grammar for this was originally written following the
SQL standard's description to the letter.  AFAICS reducing the number of
nonterminals as you have done is a good thing.  So I started from that
point (0001+0002) to see what else is missing to make that independently
committable.  One thing I noticed is that a number of grammar hacks are
not necessary until the IS JSON patch, so I've removed them from 0001
(the constructors patch) in order to make things easier to comprehend.
We can put them back together with IS JSON.  For the time being, 0001 is
already large enough.

So here's v11 of this (0001+0002 plus some changes of my own).  At this
point, the main thing I'm unhappy about is the fact that the
documentation addition puts the new contents at the end of the chapter,
which makes no sense.  So we now have:

9.16.1. Processing and Creating JSON Data
9.16.2. The SQL/JSON Path Language
9.16.3. SQL/JSON Functions and Expressions

where the standard functions are in 9.16.3 and describe functions that
are for creating JSON data, so they should naturally be in 9.16.1.  I'll
see about reformulating the whole chapter so that it makes sense.

I added an ECPG test file, to make sure that the weird grammar
productions parse correctly.

There are other minor things too, which I'll see about.

Once I get this one done, I'll rebase and repost the rest of the series.

-- 
Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/
"Puedes vivir sólo una vez, pero si lo haces bien, una vez es suficiente"

Attachment

pgsql-hackers by date:

Previous
From: Ranier Vilela
Date:
Subject: Re: Avoid use deprecated Windows Memory API
Next
From: Jelte Fennema
Date:
Subject: Re: [EXTERNAL] Support load balancing in libpq