Re: [SQL] Current User

Lists: pgsql-sql
From: Jorge Maturana <ateo(at)labsd(dot)inf(dot)utfsm(dot)cl>
To: pgsql-sql(at)postgresql(dot)org
Subject: Current User
Date: 1998-11-11 23:30:59
Message-ID: 199811112331.UAA12693@rauli.labsd.inf.utfsm.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-sql

Hi,

I want to have a table to manage a register of the modifications made to
several tables by a group of users, that table should contain the name of the
postgres user that made the modificaction, now, How can I get the name (or
the user id) of the current user logged in?,there are some "pg_currentuser"
table to make a select?

I would thank any help.

--
Jorge Maturana Ortiz
Laboratorio de Sistemas Distribuidos - Departamento de Informatica
Universidad Tecnica Federico Santa Maria, Valparaiso - Chile
mailto:ateo(at)labsd(dot)inf(dot)utfsm(dot)cl


From: David Hartwig <daveh(at)insightdist(dot)com>
To: Jorge Maturana <ateo(at)labsd(dot)inf(dot)utfsm(dot)cl>
Cc: pgsql-sql(at)postgreSQL(dot)org
Subject: Re: [SQL] Current User
Date: 1998-11-12 21:52:26
Message-ID: 364B589A.1400E1B5@insightdist.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-sql

select CURRENT_USER;
-- or --
select usesysid from pg_user where usename = CURRENT_USER;

Jorge Maturana wrote:

> Hi,
>
> I want to have a table to manage a register of the modifications made to
> several tables by a group of users, that table should contain the name of the
> postgres user that made the modificaction, now, How can I get the name (or
> the user id) of the current user logged in?,there are some "pg_currentuser"
> table to make a select?
>
> I would thank any help.
>
> --
> Jorge Maturana Ortiz
> Laboratorio de Sistemas Distribuidos - Departamento de Informatica
> Universidad Tecnica Federico Santa Maria, Valparaiso - Chile
> mailto:ateo(at)labsd(dot)inf(dot)utfsm(dot)cl


From: darcy(at)druid(dot)net (D'Arcy J(dot)M(dot) Cain)
To: ateo(at)labsd(dot)inf(dot)utfsm(dot)cl (Jorge Maturana)
Cc: pgsql-sql(at)postgreSQL(dot)org
Subject: Re: [SQL] Current User
Date: 1998-11-13 00:12:45
Message-ID: m0ze6qz-0000eRC@druid.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-sql

Thus spake Jorge Maturana
> I want to have a table to manage a register of the modifications made to
> several tables by a group of users, that table should contain the name of the
> postgres user that made the modificaction, now, How can I get the name (or
> the user id) of the current user logged in?,there are some "pg_currentuser"
> table to make a select?

Look at insert_username in contrib/spi. Basically you create a trigger
on insert.

--
D'Arcy J.M. Cain <darcy(at){druid|vex}.net> | Democracy is three wolves
http://www.druid.net/darcy/ | and a sheep voting on
+1 416 424 2871 (DoD#0082) (eNTP) | what's for dinner.