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

Nathan Bossart <nathandbossart@gmail.com>

From: Nathan Bossart <nathandbossart@gmail.com>
To: Stepan Neretin <slpmcf@gmail.com>
Cc: jian he <jian.universality@gmail.com>, Tom Lane <tgl@sss.pgh.pa.us>, phb.emaj@free.fr, pgsql-bugs@lists.postgresql.org
Date: 2025-05-19T20:30:29Z
Lists: pgsql-bugs

Attachments

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

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. pg_dump: Fix array literals in fetchAttributeStats().