The following bug has been logged on the website:
Bug reference: 15560
Logged by: Andres Freund
Email address: andres@anarazel.de
PostgreSQL version: 11.1
Operating system: Debian/Irrelevant
Description:
Hi,
When psql re-establishes a connection it doesn't check the version of the
server like it does during startup, or when changing the connection with
\c.
Now, it's probably not extremely common that the server version changes
without any of the query parameters changing, but I definitely hit this
during development & testing, when I bring up an older version of PG to
compare behaviour.
postgres[8571][1]=# SELECT version();
┌─────────────────────────────────────────────────────────────────────────────────────────┐
│ version
│
├─────────────────────────────────────────────────────────────────────────────────────────┤
│ PostgreSQL 11.1 on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.2.0-10)
8.2.0, 64-bit │
└─────────────────────────────────────────────────────────────────────────────────────────┘
(1 row)
postgres[8571][1]=# \echo :SERVER_VERSION_NAME
11.1
postgres[8571][1]=# SELECT 1;
FATAL: 57P01: terminating connection due to administrator command
LOCATION: ProcessInterrupts, postgres.c:2957
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: Succeeded.
Time: 6.267 ms
postgres[8618][1]=# SELECT version();
┌──────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ version
│
├──────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ PostgreSQL 9.1.23 on x86_64-unknown-linux-gnu, compiled by gcc-6 (Debian
6.2.0-3) 6.2.0 20160901, 64-bit │
└──────────────────────────────────────────────────────────────────────────────────────────────────────────┘
(1 row)
Time: 4.189 ms
postgres[8618][1]=# \echo :SERVER_VERSION_NAME
11.1
Regards,
Andres