Re: Implementing RESET CONNECTION ...

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Oliver Jowett <oliver@opencloud.com>
Cc: Kris Jurka <books@ejurka.com>, Hans-Jürgen Schönig <postgres@cybertec.at>, eg@cybertec.at, pgsql-patches@postgresql.org
Date: 2005-01-04T01:27:44Z
Lists: pgsql-hackers
Oliver Jowett <oliver@opencloud.com> writes:
> Tom Lane wrote:
>> Maybe the RESET CONNECTION command
>> should have an option whether to zap prepared statements or not?

> That doesn't really help the JDBC driver case. The problem is that there 
> are prepared statements that have been set up by the driver invisibly to 
> the user. Zapping them will make the driver break, and it's too easy for 
> the user code to do a full RESET CONNECTION and accidently zap them.

Fair point, but you could make the same argument against *any* side
effect of RESET CONNECTION.  You're just complaining about PREPARE
because you can see immediately where that breaks JDBC.  Anything that
any driver does to set up per-connection state the way it wants will
be equally vulnerable.

> Having notification of either prepared statement deallocation or 
> connection reset (a la ParameterStatus for GUC changes) would help the 
> driver to recover from this case.

I'm inclined to think that we'd have to add a protocol message that
reports RESET CONNECTION to really answer objections of this type.
That seems to bring the thing into the category of "stuff that forces
a protocol version bump" :-(

Perhaps RESET CONNECTION should be a protocol-level operation instead
of a SQL command?  That would prevent user-level code from causing it
without the driver knowing.

			regards, tom lane