| From: | Corey Huinker <corey(dot)huinker(at)gmail(dot)com> |
|---|---|
| To: | Daniel Gustafsson <daniel(at)yesql(dot)se> |
| Cc: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
| Subject: | Re: pg_dump: Remove trivial usage of PQExpBuffer |
| Date: | 2025-12-16 23:02:21 |
| Message-ID: | CADkLM=e=4VY8EERZ2KJR4qCZSHWa1ax4gekUeS32GacxJeokZA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Tue, Dec 16, 2025 at 5:44 PM Daniel Gustafsson <daniel(at)yesql(dot)se> wrote:
> > On 16 Dec 2025, at 23:03, Corey Huinker <corey(dot)huinker(at)gmail(dot)com> wrote:
>
> > One thing I have noticed is the usage of PQExpBuffer in situations where
> the query has no optional parts and no string interpolation.
>
> - res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
> + res = ExecuteSqlQuery(fout,
> + "SELECT DISTINCT
> attrelid FROM pg_attribute "
> + "WHERE attacl IS NOT
> NULL",
> + PGRES_TUPLES_OK);
>
> I'm not sure I find it an improvement to put have to look after the query
> text
> (which can be long) for the ExecStatusType. Having it separated from the
> query
> is more readable IMHO (I know we have a mix of both already, but I kind of
> prefer passing in the buffer).
>
I considered replacing them all with the pattern where we assign the block
text to a char *querystr, and in fact that's done in the patch in a couple
of places where the query was an if/else constant. Is that more acceptable?
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Jacob Champion | 2025-12-16 23:09:51 | Re: Custom oauth validator options |
| Previous Message | Daniel Gustafsson | 2025-12-16 22:44:28 | Re: pg_dump: Remove trivial usage of PQExpBuffer |