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