Re: PSQL schema "describe" \dn is not escaping quotes

From: Ajin Cherian <itsajin(at)gmail(dot)com>
To: Peter Smith <smithpb2250(at)gmail(dot)com>
Cc: surya poondla <suryapoondla4(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, "jiaoshuntian(at)gmail(dot)com" <jiaoshuntian(at)gmail(dot)com>, "nishant(dot)sharma(at)enterprisedb(dot)com" <nishant(dot)sharma(at)enterprisedb(dot)com>, "jim(dot)jones(at)uni-muenster(dot)de" <jim(dot)jones(at)uni-muenster(dot)de>, "niushiji(at)gmail(dot)com" <niushiji(at)gmail(dot)com>
Subject: Re: PSQL schema "describe" \dn is not escaping quotes
Date: 2026-09-10 09:52:10
Message-ID: CAFPTHDZdJ4DpUSyAuk2jg_ukvAL=AgwaO8gQu+Jw_9rFe9dpNA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Sep 4, 2026 at 6:30 PM Peter Smith <smithpb2250(at)gmail(dot)com> wrote:
>
> Erk. Thankyou for finding that.
>
> I am surprised that patch v4 was able to pass existing regression
> tests with that bug. The \dn test cases must've had some gaps. I have
> added more tests for checking schema case in quoted names.
>
> PSA patch v5.
>
> Also, I changed the CF entry back to "Needs Review" in case there are
> more problems lurking.

Thanks for the updated match with the fixes and the new tests. The fix
works and the new tests are welcome. A few minor comments:

1.
+ for (int i = 0; i < num_schemas; i++)
+ {
+ const char *nspname = PQgetvalue(res, i, 0);
+
+ describeOneSchemaDetails(nspname, verbose);
+ }
+ }

The return value (bool) of describeOneSchemaDetails is ignored. Is it
even required?

2.
The code now allocates memory for title as well but is not freed in
the error path.

+ initPQExpBuffer(&title);
+ printfPQExpBuffer(&title, _("Schema \"%s\""), schemaname);

regards,
Ajin Cherian
Fujitsu Australia

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2026-09-10 10:05:02 Re: Offline data checksum changes can cause incorrect checksum state on standbys
Previous Message mailinglists 2026-09-10 09:47:31 unexpected behaviour generating queryid