Skip site navigation (1) Skip section navigation (2)

Re: [SQL] distinguishing different database connections

From: Alex Pilosov <alex(at)acecape(dot)com>
To: Markus Wagner <wagner(at)imsd(dot)uni-mainz(dot)de>
Cc: pgsql-interfaces <pgsql-interfaces(at)postgresql(dot)org>, "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: [SQL] distinguishing different database connections
Date: 2001-06-22 11:57:10
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-interfacespgsql-sql
You can use backend's PID from a trigger, it is unique.

On Fri, 22 Jun 2001, Markus Wagner wrote:

> 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
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)

Alex Pilosov            |
CTO - Acecape, Inc.     | AceDSL:The best ADSL in Bell Atlantic area
325 W 38 St. Suite 1005 | (Stealth Marketing Works! :)
New York, NY 10018      |

In response to

pgsql-interfaces by date

Next:From: Eduardo KotujanskyDate: 2001-06-22 12:56:29
Subject: tutorial java + postgresql
Previous:From: Christof GlaserDate: 2001-06-22 08:38:39
Subject: Re: [SQL] distinguishing different database connections

pgsql-sql by date

Next:From: Markus BertheauDate: 2001-06-22 12:06:32
Subject: select tbl1.attr1, number of tuples where tbl2.attr1=tbl1.attr1
Previous:From: Richard HuxtonDate: 2001-06-22 10:51:05
Subject: Re: pl/pgsql question (functions)

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group