Re: pg_dump: Remove trivial usage of PQExpBuffer - Mailing list pgsql-hackers

From Daniel Gustafsson
Subject Re: pg_dump: Remove trivial usage of PQExpBuffer
Date
Msg-id 991AE728-E6D2-4EDD-B52D-7BEB0625C130@yesql.se
Whole thread Raw
In response to pg_dump: Remove trivial usage of PQExpBuffer  (Corey Huinker <corey.huinker@gmail.com>)
Responses Re: pg_dump: Remove trivial usage of PQExpBuffer
List pgsql-hackers
> On 16 Dec 2025, at 23:03, Corey Huinker <corey.huinker@gmail.com> wrote:

> One thing I have noticed is the usage of PQExpBuffer in situations where the query has no optional parts and no
stringinterpolation. 

-    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




pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: [PATCH] Fix ARM64/MSVC atomic memory ordering issues on Win11 by adding explicit DMB ?barriers
Next
From: Corey Huinker
Date:
Subject: Re: pg_dump: Remove trivial usage of PQExpBuffer