Skip site navigation (1) Skip section navigation (2)

Implementing RESET CONNECTION ...

From: Hans-Jürgen Schönig <postgres(at)cybertec(dot)at>
To: pgsql-patche(at)postgresql(dot)org, pgman(at)candle(dot)pha(dot)pa(dot)us,eg(at)cybertec(dot)at
Subject: Implementing RESET CONNECTION ...
Date: 2004-12-30 12:44:36
Message-ID: 41D3F834.9090706@cybertec.at (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-patches
We have implemented a patch which can be used by connection pools for 
instance.
RESECT CONNECTION cleans up a backend so that it can be reused.
Temp tables, LISTEN / NOTIFY stuff, WITH HOLD cursors, open 
transactions, prepared statements and GUCs are cleaned up.
I hope we have not missed important per-backend information.

test=# BEGIN;
BEGIN
test=# RESET CONNECTION;
RESET
test=# COMMIT;
WARNING:  there is no transaction in progress
COMMIT
test=# PREPARE myplan(int, int) AS SELECT $1 + $2;
PREPARE
test=# RESET CONNECTION;
RESET
test=# EXECUTE myplan(1, 2);
ERROR:  prepared statement "myplan" does not exist
test=#
test=# DECLARE mycur CURSOR WITH HOLD FOR SELECT relname FROM pg_class;
DECLARE CURSOR
test=# FETCH NEXT FROM mycur;
  relname
---------
  views
(1 row)

test=# RESET CONNECTION;
RESET
test=# FETCH NEXT FROM mycur;
ERROR:  cursor "mycur" does not exist
test=# CREATE TEMP TABLE mytmp (id int4);
CREATE TABLE
test=# RESET CONNECTION;
RESET
test=# INSERT INTO mytmp VALUES (10);
ERROR:  relation "mytmp" does not exist


All regression tests passed.
It would be nice if we had this in 8.1.

	Best regards,

		Hans


-- 
Cybertec Geschwinde u Schoenig
Schoengrabern 134, A-2020 Hollabrunn, Austria
Tel: +43/660/816 40 77
www.cybertec.at, www.postgresql.at


Attachment: pgsql_resetall_20041230.patch
Description: text/x-patch (13.6 KB)

Responses

pgsql-hackers by date

Next:From: Tom LaneDate: 2004-12-30 15:05:21
Subject: Re: buildfarm NetBSD/m68k tsearch regression failure
Previous:From: Rémi ZaraDate: 2004-12-30 10:57:02
Subject: Re: buildfarm NetBSD/m68k tsearch regression failure

pgsql-patches by date

Next:From: Magnus HaganderDate: 2004-12-30 21:31:06
Subject: Win32 version numbers not correct (again, but this one is easy)
Previous:From: Manfred KoizarDate: 2004-12-30 00:15:45
Subject: Re: Bgwriter behavior

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group