Re: How to list current user and database in PSQL

From: Bosco Rama <postgres(at)boscorama(dot)com>
To: peterlen <peteralen(at)earthlink(dot)net>, pgsql-general(at)postgresql(dot)org
Subject: Re: How to list current user and database in PSQL
Date: 2013-12-31 19:06:45
Message-ID: 52C315C5.9090204@boscorama.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 12/31/13 10:55, peterlen wrote:
> After logging into the PSQL Shell Script as a particular user and database, I
> want to display who my current user is and what database I am in as I may
> have forgotten who I am logged in as in order to make sure any commands are
> going to the right place. In Oracle's SQLPlus you can do something like
> "show user" and get feedback on the user you are logged in as. Is there an
> equivalent thing for PSQL to list the user and database?

Use the connect meta without arguments, i.e.

xyz> \c
You are now connected to database "xyz" as user "demo".

or for something 'show' based:

xyz> show session authorization;
session_authorization
-----------------------
demo
(1 row)

HTH,
Bosco.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bosco Rama 2013-12-31 19:11:13 Re: How to list current user and database in PSQL
Previous Message Adrian Klaver 2013-12-31 19:06:32 Re: How to list current user and database in PSQL