What you really want is an end of session callback.
There is not one in PostgreSQL. However, if this is
for session management, you can handle this in your
application by bracketing the connection code with
the table management.
That is, in your app (or rather in your session pooling
code) follow up each close with a DELETE of the rows
in question. The only tricky part is deciding on the
key so that it is known both before and after the connection.
Does this make sense?
elein
On Fri, Nov 07, 2003 at 01:09:15PM -0800, Boris Popov wrote:
> Hello pgsql-general,
>
> I'm trying to implement a table with rows that are automatically
> deleted when the session that inserted them disconnects, sort of like
> our own alternative to pg_stat_activity. Is it possible and what
> approach should I be trying to achieve such a thing?
>
> Thanks!
>
> --
> -Boris
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index scan if your
> joining column's datatypes do not match