Re: Clarification on warning when connecting to 'pgbouncer' database via Pgbouncer - Mailing list pgsql-hackers

From Shaik Mohammad Mujeeb
Subject Re: Clarification on warning when connecting to 'pgbouncer' database via Pgbouncer
Date
Msg-id 19713fbf473.3883f78d24141.7459563773063534540@zohocorp.com
Whole thread Raw
In response to Re: Clarification on warning when connecting to 'pgbouncer' database via Pgbouncer  (Shaik Mohammad Mujeeb <mujeeb.sk@zohocorp.com>)
List pgsql-hackers
Also, let’s say hypothetically that PgBouncer had a version like 17.2 - matching the psql (client) major version. In that case, the warning wouldn’t be shown at all, which might not be accurate either.

So, I feel that if we can reliably detect when the backend is a non-PostgreSQL server, it might be better to adjust the warning accordingly, rather than relying on a client-server version comparison in such cases.



Thanks & Regards,
Shaik Mohammad Mujeeb
Member Technical Staff
Zoho Corp





---- On Wed, 28 May 2025 04:07:40 +0530 Shaik Mohammad Mujeeb <mujeeb.sk@zohocorp.com> wrote ---

> Anyway, I'm minus quite a lot on silencing this warning, because
> it is telling you about real problems you are likely to hit.
+1

I just wanted to clarify that the concern here isn’t about the warning itself being shown, but rather about the reason it conveys, which can be a bit misleading.

The current warning suggests that some psql features might not work due to the server version being 1.20. This can lead to confusion - as it did in my case - making it seem like there's an issue with PgBouncer v1.20.1. However, this same warning appears even when we use the latest version of PgBouncer, so the message doesn't accurately reflect the root cause.

Instead, a clearer message like:

"WARNING: non-PostgreSQL server. Some psql features might not work."

would be more appropriate. It immediately communicates that the server is not PostgreSQL (as in the case of PgBouncer), which would naturally explain why some psql features (like \d commands, as Euler mentioned) may not function as expected. This avoids unnecessary suspicion about the PgBouncer version being used.

The main goal here is not to suppress the warning altogether, but to make the message more meaningful and reflective of the actual scenario.

If we can reliably detect that it’s a non-PostgreSQL server, we could adjust the warning accordingly and avoid doing a (client-server)version comparison that doesn’t apply in this context.



Thanks & Regards,
Shaik Mohammad Mujeeb
Member Technical Staff
Zoho Corp




---- On Wed, 28 May 2025 03:38:12 +0530 Tom Lane <tgl@sss.pgh.pa.us> wrote ---




"David G. Johnston" <david.g.johnston@gmail.com> writes:
> psql has zero awareness of pgbouncer or any other non-PostgreSQL server you
> might be able to point it to and establish a successful connection. The
> lack of a warning previously is probably more incorrect than its presence
> now.

Yeah. I'd say the fundamental problem is that pgbouncer is abusing
the server_version parameter, which will break plenty of things
besides psql --- pg_dump for instance, and just about any other
application that needs to adjust its queries to suit different
Postgres server versions. If they feel a need to advertise
pgbouncer's version there, it wouldn't be that hard to make
server_version read out as something like "17.5 (pgbouncer XX.YY)",
which would not confuse libpq/psql (cf. parsing code in
pqSaveParameterStatus). But apparently they didn't do that.

Anyway, I'm minus quite a lot on silencing this warning, because
it is telling you about real problems you are likely to hit.

            regards, tom lane


pgsql-hackers by date:

Previous
From: Shaik Mohammad Mujeeb
Date:
Subject: Re: Clarification on warning when connecting to 'pgbouncer' database via Pgbouncer
Next
From: John Naylor
Date:
Subject: Re: Review/Pull Request: Adding new CRC32C implementation for IBM S390X