Received: from yara.imsd.uni-mainz.de (yara.IMSD.Uni-Mainz.DE [134.93.144.68]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f5M81Na33113; Fri, 22 Jun 2001 04:01:24 -0400 (EDT) (envelope-from wagner@imsd.uni-mainz.de) Received: (from smap@localhost) by yara.imsd.uni-mainz.de (8.9.3/8.9.3/lxs_5.2) id KAA18781; Fri, 22 Jun 2001 10:00:23 +0200 Received: from hermes.imsd.uni-mainz.de(134.93.64.80) by yara.imsd.uni-mainz.de via smap (V2.1/2.1+anti-relay+anti-spam) id xma018778; Fri, 22 Jun 01 10:00:15 +0200 Received: from imsd.uni-mainz.de (unverified [134.93.64.34]) by hermes.imsd.uni-mainz.de (EMWAC SMTPRS 0.83) with SMTP id ; Fri, 22 Jun 2001 09:59:40 +0200 Message-ID: <3B32FAD3.47A5A9D@imsd.uni-mainz.de> Date: Fri, 22 Jun 2001 09:59:15 +0200 From: Markus Wagner Organization: IMSD X-Mailer: Mozilla 4.7 [en] (X11; I; Linux 2.2.13 i686) X-Accept-Language: en MIME-Version: 1.0 To: pgsql-interfaces , "pgsql-sql@postgresql.org" Subject: distinguishing different database connections Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200106/64 X-Sequence-Number: 1727 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