Re: Trigger to run @ connection time?

Поиск
Список
Период
Сортировка
От Alban Hertroys
Тема Re: Trigger to run @ connection time?
Дата
Msg-id F9628CE2-56A5-4EFA-9281-E834904DD5B6@solfertje.student.utwente.nl
обсуждение исходный текст
Ответ на Re: Trigger to run @ connection time?  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Trigger to run @ connection time?  (Berend Tober <btober@ct.metrocast.net>)
Список pgsql-general
On Mar 11, 2008, at 10:28 PM, Tom Lane wrote:

> An ON CONNECT trigger enforced by the database seems a bit scary to
> me.
> If it's broken, how you gonna get into the DB to fix it?
>
>             regards, tom lane

If creating the trigger wouldn't be possible from within the database
that it's defined for (which would be strange anyway as far as I'm
concerned, since you are already connected at that point and thus
missed an opportunity to fire that trigger) this shouldn't be a problem.

To put that into an SQL statement, something like:
#template1 $ CREATE TRIGGER my_database_connect_trg BEFORE CONNECT ON
my_database EXECUTE PROCEDURE my_database_setup()

Although of course that begs the question where that procedure would
be stored; Rather not in template1, I suppose! This points to another
problem with ON CONNECT triggers, you'll likely need to be connected
to reach the stored procedure that the trigger calls! A nice chicken
and egg problem, with some scope issues on the horizon...

Regards,
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,47d85f64233091819183316!



В списке pgsql-general по дате отправления:

Предыдущее
От: "Tri Quach"
Дата:
Сообщение: Re: Relocation error:/usr/lib/libpq.so.5:undefinedsymbol: krb5_cc_get_principal
Следующее
От: Berend Tober
Дата:
Сообщение: Re: Trigger to run @ connection time?