psql should re-read connection variables after connection reset

From: Peter Billen <peter(dot)billen(at)gmail(dot)com>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: psql should re-read connection variables after connection reset
Date: 2019-05-28 09:56:03
Message-ID: CAMTXbE8e6U=EBQfNSe01Ej17CBStGiudMAGSOPaw-ALxM-5jXg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi,

After a connection reset, psql should re-read the connection variables.
This was was initially reported by ysch on IRC and confirmed in the code by
Zr40. All I'm doing here is making sure that it is reported, as per ysch's
request.

I quickly verified this as following:

1. start 11 instance
2. psql into it
3. stop 11 instance
4. start 10 instance
5. in the existing psql session, first trigger a reconnect ('select 1')
and then '\df', which depends on the server version. I got:

ERROR: column p.prokind does not exist
LINE 5: CASE p.prokind

This happens because the psql session believes it is still connected to the
11 instance, as confirmed by Zr40:

[11:32:16] <Zr40> CheckConnection (
https://github.com/postgres/postgres/blob/master/src/bin/psql/common.c#L386)
doesn't call SyncVariables (
https://github.com/postgres/postgres/blob/master/src/bin/psql/command.c#L3286)
which is called on startup (
https://github.com/postgres/postgres/blob/master/src/bin/psql/startup.c#L312
)

Best regards.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2019-05-28 10:58:02 Re: BUG #15789: libpq compilation with OpenSSL 1.1.1b fails on Windows with Visual Studio 2017
Previous Message Juan José Santamaría Flecha 2019-05-28 05:31:55 Re: BUG #15789: libpq compilation with OpenSSL 1.1.1b fails on Windows with Visual Studio 2017