pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
distinguishing different database connections
6+ messages / 6 participants
[nested] [flat]

* distinguishing different database connections
@ 2001-06-22 07:59 Markus Wagner <wagner@imsd.uni-mainz.de>
  2001-06-22 08:38 ` Re: [SQL] distinguishing different database connections Christof Glaser <gcg@gl.aser.de>
  2001-06-22 11:57 ` Re: [SQL] distinguishing different database connections Alex Pilosov <alex@acecape.com>
  2001-06-22 18:40 ` Re: [SQL] distinguishing different database connections Stephan Szabo <sszabo@megazone23.bigpanda.com>
  2001-07-03 16:07 ` Re: distinguishing different database connections Manika Dey <bithi@ipr.res.in>
  0 siblings, 4 replies; 6+ messages in thread

From: Markus Wagner @ 2001-06-22 07:59 UTC (permalink / raw)
  To: pgsql-interfaces; pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>

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



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: [SQL] distinguishing different database connections
  2001-06-22 07:59 distinguishing different database connections Markus Wagner <wagner@imsd.uni-mainz.de>
@ 2001-06-22 08:38 ` Christof Glaser <gcg@gl.aser.de>
  3 siblings, 0 replies; 6+ messages in thread

From: Christof Glaser @ 2001-06-22 08:38 UTC (permalink / raw)
  To: Markus Wagner <wagner@imsd.uni-mainz.de>; pgsql-interfaces; pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>

Hi Markus,

On Friday, 22. June 2001 09:59, 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.

I think, there is no such thing like a connection id.

> 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.

What about looking how web applications handle this? A "session id", 
which you have to manage yourself, might do what you want:

<just_an_idea>
- logon creates a session id
- actions that need to keep track of users should be done within 
functions called by the client, providing the session id as a parameter.
</idea>

HTH.
Christof



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: [SQL] distinguishing different database connections
  2001-06-22 07:59 distinguishing different database connections Markus Wagner <wagner@imsd.uni-mainz.de>
@ 2001-06-22 11:57 ` Alex Pilosov <alex@acecape.com>
  3 siblings, 0 replies; 6+ messages in thread

From: Alex Pilosov @ 2001-06-22 11:57 UTC (permalink / raw)
  To: Markus Wagner <wagner@imsd.uni-mainz.de>; +Cc: pgsql-interfaces; pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>

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@postgresql.org)
> 
> 

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




^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: [SQL] distinguishing different database connections
  2001-06-22 07:59 distinguishing different database connections Markus Wagner <wagner@imsd.uni-mainz.de>
@ 2001-06-22 18:40 ` Stephan Szabo <sszabo@megazone23.bigpanda.com>
  3 siblings, 0 replies; 6+ messages in thread

From: Stephan Szabo @ 2001-06-22 18:40 UTC (permalink / raw)
  To: Markus Wagner <wagner@imsd.uni-mainz.de>; +Cc: pgsql-interfaces; pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>


How about creating a temporary table with the data?  That'll be persistant
for the session.

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.




^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: distinguishing different database connections
  2001-06-22 07:59 distinguishing different database connections Markus Wagner <wagner@imsd.uni-mainz.de>
@ 2001-07-03 16:07 ` Manika Dey <bithi@ipr.res.in>
  2001-07-10 23:56   ` Re: Re: [INTERFACES] distinguishing different database connections Roberto Mello <rmello@cc.usu.edu>
  3 siblings, 1 reply; 6+ messages in thread

From: Manika Dey @ 2001-07-03 16:07 UTC (permalink / raw)
  To: petermount@maidstone.gov.uk; +Cc: pgsql-interfaces; pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>


Hi,
  Is postgresql database available for  WindowsNT platform.

manika

 
-------------------------------------------------------------------

From:-                          | 
 Ms. Manika Dey.                |Ph.No:--
 Engineer-SC (Comp. Tech.)      | IPR -- 02712 - 69276 
 I.P.R                          |          EXT 336,315
 BHAT, GANDHINAGAR              | Residence -- 079 - 6873114
 Gujrat -- 382 428              | FAX --- 69017
  ------------------------------------------------------------------ 




                                       
                







^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Re: [INTERFACES] distinguishing different database connections
  2001-06-22 07:59 distinguishing different database connections Markus Wagner <wagner@imsd.uni-mainz.de>
  2001-07-03 16:07 ` Re: distinguishing different database connections Manika Dey <bithi@ipr.res.in>
@ 2001-07-10 23:56   ` Roberto Mello <rmello@cc.usu.edu>
  0 siblings, 0 replies; 6+ messages in thread

From: Roberto Mello @ 2001-07-10 23:56 UTC (permalink / raw)
  To: Manika Dey <bithi@ipr.res.in>; +Cc: petermount@maidstone.gov.uk, "pgsql-sql@postgresql.org" <pgsql-sql@postgresql.org>

On Tue, Jul 03, 2001 at 11:07:35AM -0500, Manika Dey wrote:
> 
> Hi,
>   Is postgresql database available for  WindowsNT platform.

	Yes. Download CygWin at http://www.cygwin.com and read the
documentation in postgresql.org regarding installation on Windows.

	-Roberto
-- 
+----| http://fslc.usu.edu USU Free Software & GNU/Linux Club |------+
  Roberto Mello - Computer Science, USU - http://www.brasileiro.net 
       http://www.sdl.usu.edu - Space Dynamics Lab, Developer    
Dente lupus, cornu taurus petit.



^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2001-07-10 23:56 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-06-22 07:59 distinguishing different database connections Markus Wagner <wagner@imsd.uni-mainz.de>
2001-06-22 08:38 ` Christof Glaser <gcg@gl.aser.de>
2001-06-22 11:57 ` Alex Pilosov <alex@acecape.com>
2001-06-22 18:40 ` Stephan Szabo <sszabo@megazone23.bigpanda.com>
2001-07-03 16:07 ` Manika Dey <bithi@ipr.res.in>
2001-07-10 23:56   ` Roberto Mello <rmello@cc.usu.edu>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox