|
Home > Archive > PostgreSQL Discussion > January 2006 > Connected user in a triggerfunction
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Connected user in a triggerfunction
|
|
| Dick Kniep 2006-01-20, 3:23 am |
| Hi list,
We are using logging in a database based on triggers and plpgsql functions.
This works OK. However, we want deletes to be recorded too, and there we want
the user who connected to be recorded in the log. So, how can I get the
connected user in a triggerfunction?
Cheers,
Dick Kniep
---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?
http://www.postgresql.org/docs/faq
| |
| A. Kretschmer 2006-01-20, 3:23 am |
| am 20.01.2006, um 7:56:38 +0100 mailte Dick Kniep folgendes:
> Hi list,
>
> We are using logging in a database based on triggers and plpgsql functions.
> This works OK. However, we want deletes to be recorded too, and there we want
> the user who connected to be recorded in the log. So, how can I get the
> connected user in a triggerfunction?
select current_user;
HTH, Andreas
--
Andreas Kretschmer (Kontakt: siehe Header)
Heynitz: 035242/47212, D1: 0160/7141639
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
=== Schollglas Unternehmensgruppe ===
---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings
| |
| Michael Fuhr 2006-01-20, 3:23 am |
| On Fri, Jan 20, 2006 at 07:56:38AM +0100, Dick Kniep wrote:
> We are using logging in a database based on triggers and plpgsql functions.
> This works OK. However, we want deletes to be recorded too, and there we want
> the user who connected to be recorded in the log. So, how can I get the
> connected user in a triggerfunction?
Use SESSION_USER or CURRENT_USER. They're usually the same but see
the documentation for how they can differ:
http://www.postgresql.org/docs/8.1/...tions-info.html
--
Michael Fuhr
---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql
.org so that your
message can get through to the mailing list cleanly
| |
| Dick Kniep 2006-01-26, 4:57 pm |
| Anyone?
Op vrijdag 20 januari 2006 07:56, schreef Dick Kniep:
> Hi list,
>
> We are using logging in a database based on triggers and plpgsql functions.
> This works OK. However, we want deletes to be recorded too, and there we
> want the user who connected to be recorded in the log. So, how can I get
> the connected user in a triggerfunction?
>
> Cheers,
> Dick Kniep
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faq
---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match
| |
| Richard Huxton 2006-01-26, 4:57 pm |
| Dick Kniep wrote:
> Anyone?
I thought I saw an answer to this yesterday. Have you tried CURRENT_USER
? It's in the "functions and operators" section of the manuals (contrary
to appearance, it is a function).
[color=darkred]
> Op vrijdag 20 januari 2006 07:56, schreef Dick Kniep:
--
Richard Huxton
Archonet Ltd
---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?
http://archives.postgresql.org
| |
| Dick Kniep 2006-01-26, 4:57 pm |
| Oops, Sorry, didn't get the answers untill just now...
Op donderdag 26 januari 2006 10:02, schreef Richard Huxton:[color=darkre
d]
> Dick Kniep wrote:
>
> I thought I saw an answer to this yesterday. Have you tried CURRENT_USER
> ? It's in the "functions and operators" section of the manuals (contrary
> to appearance, it is a function).
>
---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings
|
|
|
|
|