Re: BUG #18923: pg_dump 18beta1 fails to process complex table names

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Stepan Neretin <slpmcf(at)gmail(dot)com>
Cc: jian he <jian(dot)universality(at)gmail(dot)com>, 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-19 20:30:29
Message-ID: aCuU5dB1DF_jOxfH@nathan
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Mon, May 19, 2025 at 02:24:47PM +0700, Stepan Neretin wrote:
> + 'CREATE SCHEMA "phil\'s schema\"3"' => {
> + create_sql => q{
> + CREATE SCHEMA "phil's schema""3";
> + SET search_path = "phil's schema""3";
> + DROP TABLE IF EXISTS "phil's tbl1";
> + CREATE TABLE "phil's tbl1" (
> + "phil's col11" serial PRIMARY KEY,
> + "phil's col12" text
> + );
> + },
> + regexp => qr/^
> + CREATE\ SCHEMA\ "phil's\ schema""3";\n
> + SET\ search_path\ =\ "phil's\ schema""3";\n
> + DROP\ TABLE\ IF\ EXISTS\ "phil's\ tbl1";\n
> + CREATE\ TABLE\ "phil's\ tbl1"\ \(\n
> + \s+"phil's\ col11"\ integer\ NOT\ NULL\ DEFAULT\ nextval\('[^']+'\)::regclass,\n
> + \s+"phil's\ col12"\ text\n
> + \s+CONSTRAINT\ "[^"]+"\ PRIMARY\ KEY\ \("phil's\ col11"\)\n
> + \);/xm,
> + like => {},
> + },

I don't think this is quite right. IIUC this test runs some commands and
makes sure that a slightly adjusted version of those commands never appears
in the dump output. This is presumably enough to reach the reported
problem, but AFAICT most of the test content is unnecessary. I think we
should simply modify an existing stats test so that we also verify the
dumped stats commands, as done in the attached patch.

--
nathan

Attachment Content-Type Size
v4-0001-pg_dump-fix-quoting-in-fetchAttributeStats.patch text/plain 3.4 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message 萧鸿骏 2025-05-20 03:28:36 Re: Re: BUG #18935: The optimiser's choice of sort doubles the execution time.
Previous Message Heikki Linnakangas 2025-05-19 15:52:50 Re: BUG #18929: After the view is created, executed query against the view definition, reported syntax error.