Re: on connect/on disconnect - Mailing list pgsql-sql

From Aaron Bono
Subject Re: on connect/on disconnect
Date
Msg-id bf05e51c0609102210ree7629dw16f544fc451de7dc@mail.gmail.com
Whole thread Raw
In response to Re: on connect/on disconnect  (Robert Edwards <bob@cs.anu.edu.au>)
List pgsql-sql
On 9/10/06, Robert Edwards <bob@cs.anu.edu.au> wrote:

As I understand it, connection pooling, as used by a web app, still
needs to connect "per-database-user" (and usually this is the same
"web-server" user). If the web app is connecting to the database
server as different database users, then different connections would
be set up. If the number of open connections exceeds the number
allowed to the database server, then older unused connections would
be terminated to allow new ones to be created. Is this correct?

Don't mean to get off topic but to answer your question...

Typically the web app has a single log in user.  You don't  have the user log into the database.  Connection pooling typically does not terminate connections to the database unless it decides to shrink the connection pool do to lack of use.  It doesn't disconnect when it exceeds the number of allowed users - it reuses the connections as much as possible to reduce the overhead of making connections.

Or is it possible, over the same connection, to change the database
user? My understanding of the frontend/backend protocol is that this
is not allowed.

I could not find this in the documentation - not sure.

Anyway, I still need to know if running functions during connection
setup and tear-down, or change of user, is possible or not.

 
If there is a table that keeps track of connection/disconnection you could put a trigger on that but I cannot find anything about this in the documentation.

Guess we will need feedback from someone more knowledgable than I...

==================================================================
   Aaron Bono
   Aranya Software Technologies, Inc.
   http://www.aranya.com
   http://codeelixir.com
==================================================================

pgsql-sql by date:

Previous
From: Richard Broersma Jr
Date:
Subject: Re: where clause subqueries vs multiple rows results
Next
From: "Penchalaiah P."
Date:
Subject: hi i am gettin error when i am deleting a function from my pgadmin