Looking at 0001 now. I noticed that it adds JSON, JSON_SCALAR and JSON_SERIALIZE as reserved keywords to doc/src/sgml/keywords/sql2016-02-reserved.txt; but those keywords do not appear in the 2016 standard as reserved. I see that those keywords appear as reserved in sql2023-02-reserved.txt, so I suppose you're covered as far as that goes; you don't need to patch sql2016, and indeed that's the wrong thing to do.
I see that you add json_returning_clause_opt, but we already have json_output_clause_opt. Shouldn't these two be one and the same? I think the new name is more sensible than the old one, since the governing keyword is RETURNING; I suppose naming it "output" comes from the fact that the standard calls this <JSON output clause>. typo "requeted" I'm not in love with the fact that JSON and JSONB have pretty much parallel type categorizing functionality. It seems entirely artificial. Maybe this didn't matter when these were contained inside each .c file and nobody else had to deal with that, but I think it's not good to make this an exported concept. Is it possible to do away with that? I mean, reduce both to a single categorization enum, and a single categorization API. Here you have to cast the enum value to int in order to make ExecInitExprRec work, and that seems a bit lame; moreso when the "is_jsonb" is determined separately (cf. ExecEvalJsonConstructor) In the 2023 standard, JSON_SCALAR is just <JSON scalar> ::= JSON_SCALAR <left paren> <value expression> <right paren> but we seem to have added a <JSON output format> clause to it. Should we really? -- Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/ "Entristecido, Wutra (canción de Las Barreras) echa a Freyr a rodar y a nosotros al mar"