From: | Nathan Bossart <nathandbossart(at)gmail(dot)com> |
---|---|
To: | jian he <jian(dot)universality(at)gmail(dot)com> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, phb(dot)emaj(at)free(dot)fr, pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | Re: BUG #18923: pg_dump 18beta1 fails to process complex table names |
Date: | 2025-05-15 18:12:41 |
Message-ID: | aCYumTym-wLvDFp8@nathan |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Tue, May 13, 2025 at 07:34:51PM +0800, jian he wrote:
> On Mon, May 12, 2025 at 9:51 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
>> > I have just run the E-Maj project regression test suite with PG18 beta1 and
>> > found a pg_dump abort when trying to dump a schema prefixed table having a
>> > complex name including single quote, double quote and space.
>>
>> Thanks for the report! Looks like fetchAttributeStats() is completely
>> misguided about the appropriate quoting rules for array elements.
D'oh, my bad.
> re-read ReadArrayToken.
> In this context, we need to care about single-quote, double-quotes.
> for backslash, we skip it.
>
> appendPGArray can help us handle double quotes,
> now we just need to make it also handle single quotes.
I don't think we want to teach appendPGArray() to handle single quotes.
That's meant for building a text representation of a 1-dimensional Postgres
array, which IIUC doesn't need to escape single quotes. Take the following
example:
postgres=# select array['nathan''s element'];
array
----------------------
{"nathan's element"}
(1 row)
My first instinct is that we need to build the array with appendPGArray()
and then append it to the query using appendStringLiteralAH(), as done in
the attached patch.
--
nathan
Attachment | Content-Type | Size |
---|---|---|
v2-0001-pg_dump-fix-quoting-in-fetchAttributeStats.patch | text/plain | 2.0 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Corey Huinker | 2025-05-15 19:03:11 | Re: BUG #18923: pg_dump 18beta1 fails to process complex table names |
Previous Message | Karl O. Pinc | 2025-05-15 17:25:59 | PGXS does not properly uninstall documentation |