distinguishing different database connections - Mailing list pgsql-sql

From Markus Wagner
Subject distinguishing different database connections
Date
Msg-id 3B32FAD3.47A5A9D@imsd.uni-mainz.de
Whole thread Raw
Responses Re: distinguishing different database connections  (Christof Glaser <gcg@gl.aser.de>)
Re: distinguishing different database connections  (Alex Pilosov <alex@acecape.com>)
Re: distinguishing different database connections  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Re: [INTERFACES] distinguishing different database connections  (Manika Dey <bithi@ipr.res.in>)
List pgsql-sql
Hi,

can I access information on the current connection from within a trigger
function?
I need to identify different server connections somehow. Something like
a "connection id" would be enough.

The background:

When a user starts a frontend application (NT, Access) he starts a new
connection to our Linux database server. But for all users the "postgres
user" is the same, since the ODBC connection is hard linked into the
application. The problem is that we need the NT user name within our
trigger (C) functions.

The idea:
Let's execute a function "logon" whenever an instance of the application
is started. This function will get the NT user name as a parameter. It
will recognize the current connection id and it would store the pair
(connection id, NT user name) in a table. Then, whenever some trigger
needs to know the user name (for logging actions), it could lookup the
user name with the current connection id.

Can we do this? Please help.

Thank you very much,

Markus


pgsql-sql by date:

Previous
From: DI Hasenöhrl
Date:
Subject: Difference between insert a tuple in a table by function and by datasheet
Next
From: Kristoff Bonne
Date:
Subject: Re: pl/pgsql question (functions)