Re: RESET CONNECTION idea

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, postgres(at)cybertec(dot)at
Subject: Re: RESET CONNECTION idea
Date: 2005-06-07 15:10:37
Message-ID: 8486.1118157037@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> What if we create a 'reset_connection' guc that is initially false, and
> is set to 'true' when someone resets a connection. Then, when it
> happens, the client finds out, reconfigures whatever it needs, then sets
> the value back to 'false'.

It seems to me that one could trivially break any driver that depends on
such a thing, just by issuing
SET reset_connection = true;
Then the driver will think the connection has been reset when it has
not, and become completely confused about the actual connection state.

You can't avoid this by making the variable protected, because then the
driver itself would be unable to clear it.

In short I don't think this can work. We'd need an actual protocol
message specifically to report RESET CONNECTION. The loss of backwards
compatibility is not necessarily a bad thing; arguably, you *want*
any client library that doesn't recognize the message to fail, since
otherwise it will be out of sync about the connection state.

Alternatively, depending on what level of client software you think
should be issuing such things, we could make the RESET request be a
new protocol message rather than a SQL statement. Then it couldn't
even be invoked by a non-updated client, and so the compatibility
problem goes away.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Matthew T. O'Connor 2005-06-07 15:16:06 Re: CPU-intensive autovacuuming
Previous Message David Fetter 2005-06-07 14:57:06 Re: [HACKERS] regexp_replace