Re: SQL/JSON revisited

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Amit Langote <amitlangote09(at)gmail(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, vignesh C <vignesh21(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, e(dot)indrupskaya(at)postgrespro(dot)ru
Subject: Re: SQL/JSON revisited
Date: 2023-03-22 12:18:46
Message-ID: 20230322121846.vcxjogqyguihkicr@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: 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.


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 —
"Puedes vivir sólo una vez, pero si lo haces bien, una vez es suficiente"

Attachment Content-Type Size
v11-0001-SQL-JSON-constructors.patch text/x-diff 186.6 KB

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Jelte Fennema 2023-03-22 12:27:00 Re: [EXTERNAL] Support load balancing in libpq
Previous Message Ranier Vilela 2023-03-22 12:18:31 Re: Avoid use deprecated Windows Memory API