function to return pg_user.usesysid

From: "Dr(dot) Ernst Molitor" <molitor(at)uni-bonn(dot)de>
To: pgsql-hackers(at)postgresql(dot)org
Cc: "Dr(dot) Ernst Molitor" <molitor(at)uni-bonn(dot)de>
Subject: function to return pg_user.usesysid
Date: 2003-02-07 12:03:55
Message-ID: 1044619436.13636.53.camel@mibi02
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dear PostgreSQL developers,

as far as I know, there is no function available to directly access the
user id (pg_(shadow|user).usesysid)
of the current database user, while the user's name is easily available
(function current_user).

For a couple of databases I'm using or designing, it is necessary to
keep track of who has changed what and when - a job perfectly easy with
the timetravel add-on (contrib/spi). Using usesysid instead of a user
name to keep track of who has entered/changed/deleted data in a certain
record offers saving a few bytes per record, so I wrote a _very small_
add-on to directly access the usesysid information, using the function
GetUserId().

This is hardly worth mentioning since it consists of just a few lines of
code, but maybe some other users might find it useful. If so, please
feel free to make it available publicly. The few lines are available at
http://mibi03.meb.uni-bonn.de/~ernst/pgsql_userid.tar.gz

Hm, by the way, what about adding a function like current_userid to the
core functionality of PostgreSQL?

Best regards,

Ernst

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Teodor Sigaev 2003-02-07 13:17:30 Please apply patch
Previous Message Elias Athanasopoulos 2003-02-07 10:55:45 cvs (7/2/2003) is broken?