Re: Trigger to run @ connection time?
От | Greg Sabino Mullane |
---|---|
Тема | Re: Trigger to run @ connection time? |
Дата | |
Msg-id | efb8dced2b33305eceef4fb084e53f92@biglumber.com обсуждение исходный текст |
Ответ на | Trigger to run @ connection time? ("Kynn Jones" <kynnjo@gmail.com>) |
Список | pgsql-general |
-----BEGIN PGP SIGNED MESSAGE----- Hash: RIPEMD160 > Hi! I want to set up a trigger (somehow) that, whenever someone connects > database my_db, will fire and thereby run a stored PLPERL procedure > perl_setup() in the new connection's environment. (BTW, this procedure adds > useful definitions, mostly subs, to Perl's main package. This needs to be > done for each connection, because such modifications of package main do not > persist from one session to the next.) I think you are going about this the wrong way. Create a hook in each plperl func that does the initial setup for you as needed. Simply store a value in $_SHARED indicating whether it has already run or not for that session. This also avoid any overhead at all of calling perl_setup() if the connection in question is never going to use plperl, or even if it is going to use plperl but does not need perl_setup(). - -- Greg Sabino Mullane greg@turnstep.com PGP Key: 0x14964AC8 200803121042 http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8 -----BEGIN PGP SIGNATURE----- iEYEAREDAAYFAkfX6+0ACgkQvJuQZxSWSsiFdQCg4WGmB4+InrL7E+7c8Tq82lFy TFcAn2lQfSXJwO8LUQ9vZPf9ZStLdVHW =R5fK -----END PGP SIGNATURE-----
В списке pgsql-general по дате отправления: