Re: BUG #18923: pg_dump 18beta1 fails to process complex table names
Nathan Bossart <nathandbossart@gmail.com>
From: Nathan Bossart <nathandbossart@gmail.com>
To: jian he <jian.universality@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, phb.emaj@free.fr, pgsql-bugs@lists.postgresql.org
Date: 2025-05-15T18:12:41Z
Lists: pgsql-bugs
Attachments
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@sss.pgh.pa.us> wrote:
>> PG Bug reporting form <noreply@postgresql.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
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
pg_dump: Fix array literals in fetchAttributeStats().
- a6060f1cbec3 18.0 landed