Re: Trigger to run @ connection time? - Mailing list pgsql-general

From Alban Hertroys
Subject Re: Trigger to run @ connection time?
Date
Msg-id BEFA5FEC-376E-45DA-A1C8-37E0FCE2AD86@solfertje.student.utwente.nl
Whole thread Raw
In response to Trigger to run @ connection time?  ("Kynn Jones" <kynnjo@gmail.com>)
Responses Re: Trigger to run @ connection time?  ("Kynn Jones" <kynnjo@gmail.com>)
List pgsql-general
On Mar 10, 2008, at 9:07 PM, Kynn Jones wrote:

> So I tried to find some system table that would get modified
> whenever a new connection was made, but I was unsuccessful.  The
> closest I found was the VIEW pg_activity, and the crucial
> information I need from this view comes from procedures like
> pg_stat_get_backend_pid().

You can't define triggers on system tables.

> Is there a bona fide table (not a view!) that I could use to define
> an "on connect" trigger?  (This table would not only have to
> undergo some INSERT or UPDATE event at the time of the new
> connection, but it should also provide enough information to allow
> my code to determine which database is being connected to.)

I'm afraid not, although there's been mention on this ML of on
connect triggers before. Not sure whether that got solved though...

> If not, is there some other way to set up a trigger that

Closest thing I can think of is defining a table that you insert a
record in as soon as you connect and put a trigger on that.

Alban Hertroys

--
If you can't see the forest for the trees,
cut the trees and you'll see there is no forest.


!DSPAM:737,47d5c63d233091216612506!



pgsql-general by date:

Previous
From: John Cartwright
Date:
Subject: Re: php pg_connect fails, pgsql works - RESOLVED
Next
From: Kevin Kempter
Date:
Subject: PostgreSQL and MOLAP ?