Markus Schiltknecht wrote:
> On Mon, 2006-04-10 at 17:22 +0800, Qingqing Zhou wrote:
> > Check the code InitPostgres(). These global varaibles are scattered in many
> > places, so I am not sure if it is easy to write clean code to clear up these
> > variables. But if you can come up with a patch to do reconnect without
> > disconnect, that will be cool.
>
> Yes, that's where I've been playing around already. Not with much
> success until now, though. :-(
An idea arising in chat with Joshua Drake: the retargetting code, if it
turns out to work and not be excessively expensive, could also be useful
to implement a server-side "connection pooling" of sorts: the postmaster
could keep idle backends and retarget them to a database that receives
an incoming connection. However, we'd also need a mechanism to clean
all backend state previous to reusing a connection, to leave it "as
new" (no prepared statements, WITH HOLD cursors, etc.)
--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support