| From: | Jonathan Bartlett <johnnyb6(at)SDF(dot)lonestar(dot)org> |
|---|---|
| To: | pgsql-sql(at)postgresql(dot)org |
| Subject: | Setting session global variables |
| Date: | 2001-05-17 00:43:45 |
| Message-ID: | Pine.LNX.4.21.0105170038040.4509-100000@sdf.lonestar.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
Is there a way to set a session global variable in PostgreSQL? The only
thing I see are examples of setting config variables. What I would like
to do is this:
Have a table "insertedby" or something that has
created_object oid,
created_by_user oid,
creation_date datetime
Then have a procedure, so that any table that wanted to record who
inserted which record could just use that procedure as an insert
trigger. The trigger would simply read the "current_user" session
variable (which the client had presumably set upon connection) and use it
to populate the "created_by_user" field.
However, the only way I can see to implement this is to have session
global variables. Is there a way to fake session global variables with a
table? Any comments would be appreciated.
Jon
johnnyb6(at)sdf(dot)lonestar(dot)org
SDF Public Access UNIX System - http://sdf.lonestar.org
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2001-05-17 01:12:44 | Re: Setting session global variables |
| Previous Message | Ligia Pimentel | 2001-05-16 21:29:57 | Re: fatal ERROR running simple join query... |