Re: How to determine the current user

From: Sean Chittenden <sean(at)chittenden(dot)org>
To: Michael Brusser <michael(at)synchronicity(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: How to determine the current user
Date: 2003-10-14 19:14:04
Message-ID: 20031014191404.GC21028@perrin.nxad.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

> I'm running Pg v7.3.4
> I have a function where I need to determine the current user.
> But since the function was created with option "SECURITY DEFINER"
> (it has to be this way) current_user returns the name of creator,
> rather than current user.
>
> Is there a way in such function find out the real current user?

CURRENT_USER should be right. SESSION_USER is the username that
connected to the DB. Look at table 6-27, session information
functions:

http://www.postgresql.org/docs/7.3/static/functions-misc.html

-sc

--
Sean Chittenden

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Muhyiddin A.M Hayat 2003-10-15 01:01:42 Create View
Previous Message Peter Eisentraut 2003-10-14 18:34:19 Re: get diagnostics not supported by ecpg?