Re: [DEPARSE] A COLLATE clause in the URI of XMLNAMESPACES does not read back

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: assam258(at)gmail(dot)com
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [DEPARSE] A COLLATE clause in the URI of XMLNAMESPACES does not read back
Date: 2026-10-27 19:57:02
Message-ID: 993647.1793131022@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Henson Choi <assam258(at)gmail(dot)com> writes:
> The namespace URI in XMLNAMESPACES is a b_expr in the grammar, so an
> expression with a COLLATE clause has to be in parentheses there.
> Pretty-printed output leaves them out, so the definition of a view
> using one cannot be read back. The two attached patches add a test
> and fix it.

I'm inclined to reject this on the grounds that it depends on a false
expectation, namely that the output of pretty-print mode is guaranteed
to parse back in every case. If that were guaranteed, we would not
need the non-pretty-print mode. AFAICS the troublesome cases do work
fine in non-pretty-print mode, so this doesn't break pg_dump.

If these cases were likely to appear in the field, maybe we'd fix it
anyway, but I can't get excited about that. When would a namespace
argument be anything but a literal? The SQL spec doesn't appear
to allow anything but <character string literal> there, so we're
already going above-and-beyond by allowing b_expr. If anything,
it's a spec-compatibility bug that we tend to render the argument
as 'foo'::text and not just 'foo' (not that I'm excited about
fixing that either).

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bharath Rupireddy 2026-10-27 20:06:28 Re: Be strict when request to flush past end of WAL in WaitXLogInsertionsToFinish
Previous Message Peter Eisentraut 2026-10-27 19:50:53 ICU fixed digit reordering bug