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

From: Stepan Neretin <slpmcf(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>, Nathan Bossart <nathandbossart(at)gmail(dot)com>, 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 07:24:47
Message-ID: CA+Yyo5RP7QvPOOgSS0U234HCSA5T-UStin0wkRo1Z_XY5+=VNg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Fri, May 16, 2025 at 9:51 PM jian he <jian(dot)universality(at)gmail(dot)com> wrote:

> On Fri, May 16, 2025 at 3:03 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> >
> > Yeah, I think so. I was confused for a bit because the one extant
> > user of appendPGArray is getNamespaces which does an additional layer
> > of quote-doubling via quoteAclUserName. However, that seems to be
> because
> > it's trying to build aclitem[] arrays whose elements will be read by
> > aclitemin, and that de-dups double quotes.
> >
>
> getNamespaces use appendPGArray for object's initial ACL string
>
> getNamespaces
> ``
> nsinfo[i].dacl.initprivs = pstrdup(aclarray->data);
> ``
>
> and we seems *only* use it dumpACL->buildACLCommands
> ``
> if (!parsePGArray(baseacls, &baseitems, &nbaseitems))
> {
> free(aclitems);
> free(baseitems);
> return false;
> }
> ``
> parsePGArray didn't handle single-quotes.
>
> I think the above is the reason single-quotes within array elements didn't
> cause
> trouble.
>
>
>
Hi,

I’ve added a regression test covering problem

This patch combines Nathan Bossart’s original fix with suggestions from Tom
Lane and Jian He. It uses appendPGArray() to build the arrays and
appendStringLiteralAH() to quote them correctly in the EXECUTE statement.

Patch attached. Looking forward to your feedback.

Best regards,

Stepan Neretin

Attachment Content-Type Size
v2-0001-Fix-quoting-of-complex-schema-and-table-names-in-.patch text/x-patch 3.9 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2025-05-19 08:44:51 BUG #18934: Even with WITH ADMIN OPTION, I Cannot Manage Role Memberships
Previous Message Laurenz Albe 2025-05-19 07:15:56 Re: Understanding JDBC Behaviour