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

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

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

Best regards, 


---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

Reply via email to