Missing quotes when deparsing XMLTABLE() and SQL/JSON query functions

Started by Dean Rasheedover 1 year ago3 messageshackers
Jump to latest
#1Dean Rasheed
dean.a.rasheed@gmail.com

While looking over ruleutils.c, I noticed a couple of places that fail
to properly quote certain outputs:

1. XML namespace names in XMLTABLE().

2. variable names in the PASSING clause of the SQL/JSON query
functions JSON_EXISTS(), JSON_QUERY(), and JSON_VALUE() (but not
JSON_TABLE(), which has similar code that does quote variable names
properly).

I scanned the rest of ruleutils.c, and didn't find any other issues.

Regards,
Dean

Attachments:

v1-0001-Fix-XMLTABLE-deparsing-to-quote-namespace-names-i.patchtext/x-patch; charset=US-ASCII; name=v1-0001-Fix-XMLTABLE-deparsing-to-quote-namespace-names-i.patchDownload+14-8
v1-0002-Fix-JsonExpr-deparsing-to-quote-variable-names-in.patchtext/x-patch; charset=US-ASCII; name=v1-0002-Fix-JsonExpr-deparsing-to-quote-variable-names-in.patchDownload+22-6
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Dean Rasheed (#1)
Re: Missing quotes when deparsing XMLTABLE() and SQL/JSON query functions

Dean Rasheed <dean.a.rasheed@gmail.com> writes:

While looking over ruleutils.c, I noticed a couple of places that fail
to properly quote certain outputs:

1. XML namespace names in XMLTABLE().

+1, but you also need to update the xml_1.out and xml_2.out files.
IIRC, xml_1.out is what comes out without --with-libxml.
I forget what's different about xml_2.out, but you can probably
just clone the diff for xml.out and be fine.

regards, tom lane

#3Dean Rasheed
dean.a.rasheed@gmail.com
In reply to: Tom Lane (#2)
Re: Missing quotes when deparsing XMLTABLE() and SQL/JSON query functions

On Sat, 11 Jan 2025 at 15:42, Tom Lane <tgl@sss.pgh.pa.us> wrote:

+1, but you also need to update the xml_1.out and xml_2.out files.
IIRC, xml_1.out is what comes out without --with-libxml.
I forget what's different about xml_2.out, but you can probably
just clone the diff for xml.out and be fine.

Ah yes, I see. Thanks for that. It looks like the differences in
xml_2.out were for a specific change in libxml2 behaviour that only
affects error details in a small number of cases, so cloning the diffs
looks like it should be fine in this case.

Regards,
Dean