| From: | Peter Smith <smithpb2250(at)gmail(dot)com> |
|---|---|
| To: | Steven Niu <niushiji(at)gmail(dot)com> |
| Cc: | Ajin Cherian <itsajin(at)gmail(dot)com>, 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> |
| Subject: | Re: PSQL schema "describe" \dn is not escaping quotes |
| Date: | 2026-09-28 02:54:22 |
| Message-ID: | CAHut+PtUM4pGRc2-g-uKaxDMFcwRrQLQ7dw0Qsr+7MUxomgmUw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Thu, Sep 24, 2026 at 3:39 PM Steven Niu <niushiji(at)gmail(dot)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 | Content-Type | Size |
|---|---|---|
| v7-0001-Fix-escapes-for-psql-describe-schema-patterns.patch | application/octet-stream | 16.1 KB |
| From | Date | Subject | |
|---|---|---|---|
| Previous Message | Greg Burd | 2026-09-28 01:27:33 | Re: Tepid: selective index updates for heap relations |