proposal: psql: show current user in prompt

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема proposal: psql: show current user in prompt
Дата
Msg-id CAFj8pRBFU-WzzQhNrwRHn67N0Ug8a9-0-9BOo69PPtcHiBDQMA@mail.gmail.com
обсуждение исходный текст
Ответы Re: proposal: psql: show current user in prompt  (Corey Huinker <corey.huinker@gmail.com>)
Список pgsql-hackers
Hi

one visitor of p2d2 (Prague PostgreSQL Developer Day) asked if it is possible to show the current role in psql's prompt. I think it is not possible, but fortunately (with some limits) almost all necessary work is done, and the patch is short.

In the assigned patch I implemented a new prompt placeholder %N, that shows the current role name.

(2023-02-03 15:52:28) postgres=# \set PROMPT1 '%n as %N at '%/%=%#
pavel as pavel at postgres=#set role to admin;
SET
pavel as admin at postgres=>set role to default;
SET
pavel as pavel at postgres=#

Comments, notes are welcome.

Regards

Pavel

Вложения

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Make EXPLAIN generate a generic plan for a parameterized query
Следующее
От: Laurenz Albe
Дата:
Сообщение: Re: Make EXPLAIN generate a generic plan for a parameterized query