Thread: How to get current user

How to get current user

From
guillermo@gnsis.net (Guillermo)
Date:
Hi,

How can I get in a PL/pgSQL function, the current user name? I want to
restrict updating a field if the user is not a Superuser.

Thanx,
Guillermo

Re: How to get current user

From
Terry Lee Tucker
Date:
This works for me:
                SELECT INTO peopleRec log_name, position FROM people
                        WHERE lower(log_name) = lower(current_user);

On Tuesday 16 November 2004 03:28 pm, Guillermo saith:
> Hi,
>
> How can I get in a PL/pgSQL function, the current user name? I want to
> restrict updating a field if the user is not a Superuser.
>
> Thanx,
> Guillermo
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
>       subscribe-nomail command to majordomo@postgresql.org so that your
>       message can get through to the mailing list cleanly

--
Quote: 26
"To those who cite the First Amendment as reason for excluding God from
 more and more of our institutions everyday; I say: The First Amendment
 of the Constitution was not written to protect the people of this country
 from religious values; it was written to protect religious values from
 government tyranny."

 --Ronald Reagan

 Work: 1-336-372-6812
 Cell: 1-336-363-4719
email: terry@esc1.com