Identify Login User & Permissions
I can't find in the docs or using Google how one can identify which
user is currently logged in to psql. I search for the command that if
for some reason I forget which user I am logged in as, rather than
logging out of PostgreSQL, there has to be a command that shows me who
I am and also what kind of special permissions my current user has.
Can anyone please assist me or point me in the right direction?
Le 14/09/2010 22:01, Carlos Mennens a �crit :
I can't find in the docs or using Google how one can identify which
user is currently logged in to psql. I search for the command that if
for some reason I forget which user I am logged in as, rather than
logging out of PostgreSQL, there has to be a command that shows me who
I am and also what kind of special permissions my current user has.
Can anyone please assist me or point me in the right direction?
SELECT current_user;
--
Guillaume
http://www.postgresql.fr
http://dalibo.com
On Tue, Sep 14, 2010 at 4:23 PM, Guillaume Lelarge
<guillaume@lelarge.info> wrote:
SELECT current_user;
Thanks. That worked well:
postgres=# SELECT current_user;
current_user
--------------
carlos
(1 row)
Do you know how I can verify what privileges or permissions 'carlos'
has granted to him in PostgreSQL?
On Tue, Sep 14, 2010 at 1:01 PM, Carlos Mennens
<carlos.mennens@gmail.com> wrote:
I can't find in the docs or using Google how one can identify which
user is currently logged in to psql. I search for the command that if
for some reason I forget which user I am logged in as, rather than
logging out of PostgreSQL, there has to be a command that shows me who
I am and also what kind of special permissions my current user has.
Can anyone please assist me or point me in the right direction?
I don't have the entire answer. But here is a place to start:
http://www.postgresql.org/docs/9.0/static/functions-info.html
Note that there is a slight distinction between current_user and session_user.
postgres=> select user, current_user, session_user;
current_user | current_user | session_user
--------------+--------------+--------------
broersr | broersr | broersr
(1 row)
--
Regards,
Richard Broersma Jr.
Visit the Los Angeles PostgreSQL Users Group (LAPUG)
http://pugs.postgresql.org/lapug
On Tue, Sep 14, 2010 at 1:28 PM, Carlos Mennens
<carlos.mennens@gmail.com> wrote:
Do you know how I can verify what privileges or permissions 'carlos'
has granted to him in PostgreSQL?
psql has its own commands.
for example if i was to see the owner of all:
users:
db=> \du
schemas:
db=> \dn
tables/views:
db => \d
other useful commands:
db => \?
--
Regards,
Richard Broersma Jr.
Visit the Los Angeles PostgreSQL Users Group (LAPUG)
http://pugs.postgresql.org/lapug
Le 14/09/2010 22:28, Carlos Mennens a �crit :
On Tue, Sep 14, 2010 at 4:23 PM, Guillaume Lelarge
<guillaume@lelarge.info> wrote:SELECT current_user;
Thanks. That worked well:
postgres=# SELECT current_user;
current_user
--------------
carlos
(1 row)Do you know how I can verify what privileges or permissions 'carlos'
has granted to him in PostgreSQL?
You need to check many things on the catalogs to know that. You won't
find a single command to do that.
--
Guillaume
http://www.postgresql.fr
http://dalibo.com