Re: How to list current user and database in PSQL

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: How to list current user and database in PSQL
Дата
Msg-id 52C315B8.2040006@gmail.com
обсуждение исходный текст
Ответ на How to list current user and database in PSQL  (peterlen <peteralen@earthlink.net>)
Ответы Re: How to list current user and database in PSQL
Список pgsql-general
On 12/31/2013 10:55 AM, 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?


test=> select current_user;
  current_user
--------------
  aklaver
(1 row)

test=> select current_database();
  current_database
------------------
  test

Or you can change the psql prompt to display the information:

http://www.postgresql.org/docs/9.3/interactive/app-psql.html

Search for:

"Prompting"

Details the variables available

"Files"

Explains how to persist this information in a psqlrc file.

>
> Thanks - Peter
>
>
>
> --
> View this message in context:
http://postgresql.1045698.n5.nabble.com/How-to-list-current-user-and-database-in-PSQL-tp5784928.html
> Sent from the PostgreSQL - general mailing list archive at Nabble.com.
>
>


--
Adrian Klaver
adrian.klaver@gmail.com


В списке pgsql-general по дате отправления:

Предыдущее
От: peterlen
Дата:
Сообщение: How to list current user and database in PSQL
Следующее
От: Bosco Rama
Дата:
Сообщение: Re: How to list current user and database in PSQL