Thread: Execute a function upon a connection made/closed
Hi,
Is there any way to execute a function upon a new connection made or existing one closed?
Is active connections info stored on a table or (?) ?
Regards,
Mustafa
Is there any way to execute a function upon a new connection made or existing one closed?
Is active connections info stored on a table or (?) ?
Regards,
Mustafa
am Fri, dem 13.10.2006, um 12:25:38 +0300 mailte Uyelik folgendes: > Hi, > Is there any way to execute a function upon a new connection made or existing > one closed? IIRC no, but you can set variables, perhaps this will help you. ALTER name SET parameter { TO | = } { value | DEFAULT } > Is active connections info stored on a table or (?) ? In a system-view, pg_stat_activity. You can select from there. HTH, Andreas -- Andreas Kretschmer Kontakt: Heynitz: 035242/47215, D1: 0160/7141639 (mehr: -> Header) GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net
A. Kretschmer wrote, On 13.10.2006 12:32:
Do you mean; after a connection made by a client, client first set a variable? I need a server side solution?am Fri, dem 13.10.2006, um 12:25:38 +0300 mailte Uyelik folgendes:Hi, Is there any way to execute a function upon a new connection made or existing one closed?IIRC no, but you can set variables, perhaps this will help you. ALTER name SET parameter { TO | = } { value | DEFAULT }
Yes, i can query this view, but i need to do some thing on database upon a new connection info added to this (view) or deleted. But this is a view and i cant add trigger? More deeply where is the connection info stored?Is active connections info stored on a table or (?) ?In a system-view, pg_stat_activity. You can select from there.
Thanks,HTH, Andreas
Mustafa
am Fri, dem 13.10.2006, um 12:47:09 +0300 mailte Uyelik folgendes: > > A. Kretschmer wrote, On 13.10.2006 12:32: > > am Fri, dem 13.10.2006, um 12:25:38 +0300 mailte Uyelik folgendes: > > > Hi, > Is there any way to execute a function upon a new connection made or existing > one closed? > > > > IIRC no, but you can set variables, perhaps this will help you. > ALTER name SET parameter { TO | = } { value | DEFAULT } > > > > > Do you mean; after a connection made by a client, client first set a variable? > I need a server side solution? No, you can define per user server-side variables like search_path. Independent of the client-program, every times the user logged in this variable set. But i don't know a solution to call a function on login/logout, sorry. > > > > Is active connections info stored on a table or (?) ? > > > > In a system-view, pg_stat_activity. You can select from there. > > > > > Yes, i can query this view, but i need to do some thing on database upon a new > connection info added to this (view) or deleted. But this is a view and i cant > add trigger? More deeply where is the connection info stored? IIRC, it's not possible to create a TRIGGER on system-tables. Read more about this: http://www.postgresql.org/docs/8.1/interactive/monitoring-stats.html HTH, Andreas -- Andreas Kretschmer Kontakt: Heynitz: 035242/47215, D1: 0160/7141639 (mehr: -> Header) GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net