Re: pg_dump: Remove trivial usage of PQExpBuffer

From: Daniel Gustafsson <daniel(at)yesql(dot)se>
To: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: pg_dump: Remove trivial usage of PQExpBuffer
Date: 2025-12-16 22:44:28
Message-ID: 991AE728-E6D2-4EDD-B52D-7BEB0625C130@yesql.se
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

--
Daniel Gustafsson

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Corey Huinker 2025-12-16 23:02:21 Re: pg_dump: Remove trivial usage of PQExpBuffer
Previous Message Andres Freund 2025-12-16 22:36:13 Re: [PATCH] Fix ARM64/MSVC atomic memory ordering issues on Win11 by adding explicit DMB ?barriers