Thread: Connection/closedown triggers for backends?

Connection/closedown triggers for backends?

From
"Richard Huxton"
Date:
Does such a thing exist (I'm guessing not)

What I'd like is to be able to call a function when someone connects to a
database and another when they disconnect.

Obviously my application can call a function when it first connects, but
might not be able to do so on disconnect (e.g. user pulls plug)

Ideally there'd be a "pg_connections" table with a PID and a time and I
could add triggers to the insert and delete actions.

If there's no way of doing this internally, I've got ways to work around it
but they're not nearly as pleasant.

- Richard Huxton