Re: How to find out who is calling the function - Mailing list pgsql-general

From Duane Lee - EGOVX
Subject Re: How to find out who is calling the function
Date
Msg-id 64EDC403A1417B4299488BAE87CA7CBF01CD0E5B@maricopa_xcng0
Whole thread Raw
In response to How to find out who is calling the function  ("BARTKO Zoltan" <bartko.zoltan@pobox.sk>)
List pgsql-general
Why not use CURRENT_USER?
-----Original Message-----
From: BARTKO Zoltan [mailto:bartko.zoltan@pobox.sk]
Sent: Friday, June 04, 2004 10:34 PM
To: pgsql-general@postgresql.org
Subject: [GENERAL] How to find out who is calling the function

Dear friends,
 
I had a look at www.pgsql.ru, looking for how to find out what user is calling the function - from inside the function. No luck.
 
Could someone enlighten me:
 
I have a stored function. I want to do the following:
 
if caller() = ''userA'' then
    return -1;        -- error
else
    return 0;
end if;            -- OK
 
caller() is the function I am looking for. Is there any function like this? If not, is there a way how to write one?
 
Thanks
 
Zoltan

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] CREATE DATABASE on the heap with PostgreSQL?
Next
From: Prabu Subroto
Date:
Subject: postgres on SuSE 9.1