| From: | Peter Smith <smithpb2250(at)gmail(dot)com> |
|---|---|
| To: | Ajin Cherian <itsajin(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-04 08:29:42 |
| Message-ID: | CAHut+PvCniutJGAw3ESMP4xDJJjC2ws1Omsp6j9vJ7CtpKETNQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Fri, Sep 4, 2026 at 2:33 PM Ajin Cherian <itsajin(at)gmail(dot)com> wrote:
>
> On Wed, Sep 2, 2026 at 7:19 PM Peter Smith <smithpb2250(at)gmail(dot)com> wrote:
> >
> > I've also added more test cases for verified multiple schema/footers
> > with a common \dn pattern.
> >
> > ~~~
> >
> > PSA patch v4.
>
> Hello Peter,
>
> Thanks for the patch. I tested a few things and found a bug:
>
> postgres=# CREATE SCHEMA "MySchema";
> CREATE SCHEMA
> postgres=# CREATE PUBLICATION pub_mixed FOR TABLES IN SCHEMA "MySchema";
> CREATE PUBLICATION
> postgres=# \dn "MySchema"
> Schema "MySchema"
> Name | Owner
> ------+-------
>
> The patch doesn't seem to work with certain quoted words. I don't
> think you should be calling validateSQLNamePattern() and
> processSQLNamePattern() from within describeOneSchemaDetails().
> validateSQLNamePattern and processSQLNamePattern() assume that you are
> passing in patterns rather than actual schema names and then go on to
> standardise the name (like lowercasing it), but by the time the code
> is inside describeOneSchemaDetails(), you already have the actual
> schema name. These functions then convert the actual schema name
> MySchema to myschema but then don't find it in the database, which is
> why it isn't shown in the describe output.
>
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.
======
Kind Regards,
Peter Smith
Fujitsu Australia.
| Attachment | Content-Type | Size |
|---|---|---|
| v5-0001-Fix-escapes-for-psql-describe-schema-patterns.patch | application/octet-stream | 15.7 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Nazir Bilal Yavuz | 2026-09-04 08:40:38 | Re: Stabilize recovery conflict stats checks in 031_recovery_conflict.pl |
| Previous Message | Ewan Young | 2026-09-04 08:20:51 | Re: Introducing find_all_inheritors_ordered() |