X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 08B03D1B4ED for ; Tue, 14 Oct 2003 19:14:35 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 73047-04 for ; Tue, 14 Oct 2003 16:14:04 -0300 (ADT) Received: from perrin.nxad.com (internal.nxad.com [69.1.70.251]) by svr1.postgresql.org (Postfix) with ESMTP id 340AAD1B532 for ; Tue, 14 Oct 2003 16:14:03 -0300 (ADT) Received: by perrin.nxad.com (Postfix, from userid 1001) id 1A49121058; Tue, 14 Oct 2003 12:14:04 -0700 (PDT) Date: Tue, 14 Oct 2003 12:14:04 -0700 From: Sean Chittenden To: Michael Brusser Cc: pgsql-sql@postgresql.org Subject: Re: How to determine the current user Message-ID: <20031014191404.GC21028@perrin.nxad.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-PGP-Key: finger seanc@FreeBSD.org X-PGP-Fingerprint: 3849 3760 1AFE 7B17 11A0 83A6 DD99 E31F BC84 B341 X-Web-Homepage: http://sean.chittenden.org/ User-Agent: Mutt/1.5.4i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/165 X-Sequence-Number: 15565 > 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