Get ride of pqbool artifact (src/interfaces/libpq/libpq-fe.h)
Hi.
In libpq-fe.h has an artifact pre C99, pqbool.
IMO this is not more necessary, once Postgres supports C99
and bool becomes standard.
So get ride of pqbool and use bool instead.
trivial patch attached.
best regards,
Ranier Vilela
Attachments:
v1-001-get-ride-pqbool-libpq-fe.patchapplication/octet-stream; name=v1-001-get-ride-pqbool-libpq-fe.patchDownload
diff --git a/src/interfaces/libpq/libpq-fe.h b/src/interfaces/libpq/libpq-fe.h
index af8004f952..5cbcdd7d29 100644
--- a/src/interfaces/libpq/libpq-fe.h
+++ b/src/interfaces/libpq/libpq-fe.h
@@ -245,16 +245,14 @@ typedef void (*PQnoticeReceiver) (void *arg, const PGresult *res);
typedef void (*PQnoticeProcessor) (void *arg, const char *message);
/* Print options for PQprint() */
-typedef char pqbool;
-
typedef struct _PQprintOpt
{
- pqbool header; /* print output field headings and row count */
- pqbool align; /* fill align the fields */
- pqbool standard; /* old brain dead format */
- pqbool html3; /* output html tables */
- pqbool expanded; /* expand tables */
- pqbool pager; /* use pager for output if needed */
+ bool header; /* print output field headings and row count */
+ bool align; /* fill align the fields */
+ bool standard; /* old brain dead format */
+ bool html3; /* output html tables */
+ bool expanded; /* expand tables */
+ bool pager; /* use pager for output if needed */
char *fieldSep; /* field separator */
char *tableOpt; /* insert to HTML <table ...> */
char *caption; /* HTML <caption> */
Ranier Vilela <ranier.vf@gmail.com> writes:
In libpq-fe.h has an artifact pre C99, pqbool.
IMO this is not more necessary, once Postgres supports C99
and bool becomes standard.
So get ride of pqbool and use bool instead.
We can't really remove that typedef ever, because application code
might be using it. Unlikely I concede, but nonetheless it's part
of libpq's exposed API.
We might be able to s/pqbool/bool/ in the struct, but I kind of
wonder if that wouldn't be an ABI break: at the very least it
would lead to subtle changes in code compiled to use the struct.
On the whole I see little value in taking any risk here.
regards, tom lane
On Tue, Sep 2, 2025 at 12:44 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
We might be able to s/pqbool/bool/ in the struct, but I kind of
wonder if that wouldn't be an ABI break: at the very least it
would lead to subtle changes in code compiled to use the struct.
I have FUD around C++ compilers in particular when it comes to ABI
assumptions for bool.
On the whole I see little value in taking any risk here.
+1
--Jacob
Em ter., 2 de set. de 2025 às 16:44, Tom Lane <tgl@sss.pgh.pa.us> escreveu:
Ranier Vilela <ranier.vf@gmail.com> writes:
In libpq-fe.h has an artifact pre C99, pqbool.
IMO this is not more necessary, once Postgres supports C99
and bool becomes standard.So get ride of pqbool and use bool instead.
We can't really remove that typedef ever, because application code
might be using it. Unlikely I concede, but nonetheless it's part
of libpq's exposed API.We might be able to s/pqbool/bool/ in the struct, but I kind of
wonder if that wouldn't be an ABI break: at the very least it
would lead to subtle changes in code compiled to use the struct.
On the whole I see little value in taking any risk here.
Thanks Tom, for the explanation.
best regards,
Ranier Vilela