DEALLOCATE ALL - Mailing list pgsql-patches

From Marko Kreen
Subject DEALLOCATE ALL
Date
Msg-id e51f66da0703270729n4726dd14s992f6a2ed2e351@mail.gmail.com
Whole thread Raw
Responses Re: DEALLOCATE ALL  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Re: DEALLOCATE ALL  (Neil Conway <neilc@samurai.com>)
List pgsql-patches
When pooling connections where prepared statements are in use,
it is hard to give new client totally clean connection as
there may be allocated statements that give errors when
new client starts preparing statements again.

Currently PgPool solves the situation by parsing all queries
and keeping list of prepares statements.  This may not be a big
problem for it as it parses the queries anyway, but for simple
pooler like PgBouncer (see pgfoundry) that does not look inside
libpq packets it is huge problem.

Attached is a patch that allows keyword ALL to be used with
DEALLOCATE and then frees all prepared queryes.  I think it is
useful for most pooling situations, not only PgBouncer.
Also its similar in the spirit to RESET ALL.

I did it slightly hacky way - if DeallocateStmt->name is
NULL is signifies DEALLOCATE ALL command.  All the code
that looks into DeallocateStmt seems to survive the situation
so it should be problem.  If still a new node is needed
or additional field in the node I can rework the patch.

--
marko

Attachment

pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Unbroke srcdir!=builddir compilation
Next
From: Bruce Momjian
Date:
Subject: Re: Warning about LISTEN names