pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Sean Chittenden <sean@chittenden.org>
To: Michael Brusser <michael@synchronicity.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: How to determine the current user
Date: Tue, 14 Oct 2003 12:14:04 -0700
Message-ID: <20031014191404.GC21028@perrin.nxad.com> (raw)
In-Reply-To: <DEEIJKLFNJGBEMBLBAHCAEKCDMAA.michael@synchronicity.com>
References: <DEEIJKLFNJGBEMBLBAHCAEKCDMAA.michael@synchronicity.com>

> 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



view thread (2+ messages)

Message-ID: <20031014191404.GC21028@perrin.nxad.com>
Permalink:  ../20031014191404.GC21028@perrin.nxad.com/
Also on:    postgresql.org/message-id/20031014191404.GC21028@perrin.nxad.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: sean@chittenden.org, michael@synchronicity.com
  Subject: Re: How to determine the current user
  In-Reply-To: <20031014191404.GC21028@perrin.nxad.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox