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

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-11 07:55:41
Message-ID: CAHut+PuL5K2aCy=c5z=+HV9Wdog-7DEW_6MsBjdETa_C1daing@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Sep 10, 2026 at 7:52 PM Ajin Cherian <itsajin(at)gmail(dot)com> wrote:
>
...
> 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?
>

The return was there to mirror the other describeOneXXX functions, but
I neglected to check it. Now handling the result, similar to other
functions.

> 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);
>

Fixed.

PSA patch v6.

======
Kind Regards,
Peter Smith.
Fujitsu Australia

Attachment Content-Type Size
v6-0001-Fix-escapes-for-psql-describe-schema-patterns.patch application/octet-stream 16.1 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2026-09-11 07:59:37 Re: Do we reduce autovacuum_naptime max values
Previous Message Michael Paquier 2026-09-11 07:53:06 Re: Add a permission check to pg_stat_get_backend_subxact()