Get ride of pqbool artifact (src/interfaces/libpq/libpq-fe.h)

Started by Ranier Vilelaabout 1 year ago4 messageshackers
Beta feature

Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.

appliessuccessCI history

You can run a PostgreSQL built from this patch straight from Docker, with no checkout and no build:

docker run --rm -p 5432:5432 ghcr.io/hackorum-dev/postgres-patch:t52221
psql -h localhost -U postgres

Built from patchset v1 (message #1), September 20, 2026 at 09:35 AM.

Every patchset is also pushed to a branch of our PostgreSQL fork, so you can check out the same tree CI built. Without a PostgreSQL checkout:

git clone --branch t52221_1 https://github.com/hackorum-dev/postgres.git

In a checkout you already have, add the fork once:

git remote add hackorum https://github.com/hackorum-dev/postgres.git

then, for this patchset and every later one:

git fetch hackorum t52221_1 && git checkout t52221_1

Patchset v1 (message #1) is on t52221_1

Jump to latest
#1Ranier Vilela
ranier.vf@gmail.com

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:

t52221_1
v1-001-get-ride-pqbool-libpq-fe.patchapplication/octet-stream; name=v1-001-get-ride-pqbool-libpq-fe.patchDownload+6-8
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Ranier Vilela (#1)
Re: Get ride of pqbool artifact (src/interfaces/libpq/libpq-fe.h)

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

#3Jacob Champion
jacob.champion@enterprisedb.com
In reply to: Tom Lane (#2)
Re: Get ride of pqbool artifact (src/interfaces/libpq/libpq-fe.h)

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

#4Ranier Vilela
ranier.vf@gmail.com
In reply to: Tom Lane (#2)
Re: Get ride of pqbool artifact (src/interfaces/libpq/libpq-fe.h)

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