Re: PSQL schema "describe" \dn is not escaping quotes - Mailing list pgsql-hackers

From Peter Smith
Subject Re: PSQL schema "describe" \dn is not escaping quotes
Date
Msg-id CAHut+PtUM4pGRc2-g-uKaxDMFcwRrQLQ7dw0Qsr+7MUxomgmUw@mail.gmail.com
Whole thread
In response to Re: PSQL schema "describe" \dn is not escaping quotes  (Steven Niu <niushiji@gmail.com>)
List pgsql-hackers
On Thu, Sep 24, 2026 at 3:39 PM Steven Niu <niushiji@gmail.com> wrote:
>
> Hi, Peter,
>
> I have two comments for V6 patch:

Thanks for your review!

>
> 1. In function describeOneSchemaDetails(), res gets assigned by PSQLexec(),
> if res is NULL, code flow goes to error_return label where termPQExpBuffer(&title) is called.
>
> However, the title is NOT initialized at all in this case.
> Suggest to initialize the title right after the initialization of buf.

Fixed as suggested.

>
> 2. Also in function describeOneSchemaDetails(), res gets assigned by PSQLexec();
>
>         res = PSQLexec(buf.data);
>
> If the PQclear() is successful, we will go inside the Footer processing,
> if pset.sversion >= 150000 and following PSQLexec() fails,
>
>                 result = PSQLexec(buf.data);
>                 if (!result)
>                         goto error_return;
>
> code flow goes to error_return label. But there is no PQclear(res), and I think it may cause memory leak;
> Suggest to initialize the res to be NULL and add PQclear(res) in error_return branch.
>

Fixed as suggested.

~

PSA patch v7.

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

Attachment

pgsql-hackers by date:

Previous
From: Greg Burd
Date:
Subject: Re: Tepid: selective index updates for heap relations
Next
From: Jelte Fennema-Nio
Date:
Subject: Re: pgindent to ignore build directories