Re: passing linux user to PG server as a variable ?

Поиск
Список
Период
Сортировка
От Ian Barwick
Тема Re: passing linux user to PG server as a variable ?
Дата
Msg-id eeb0a551-98b3-cf49-5e80-46fa95c9c547@2ndquadrant.com
обсуждение исходный текст
Ответ на passing linux user to PG server as a variable ?  (David Gauthier <davegauthierpg@gmail.com>)
Список pgsql-general
On 2020/08/18 4:52, David Gauthier wrote:

> Thanks in advance for any replies/ideas !

You could hackily repurpose the "application_name" connection parameter:

   $ whoami
   ibarwick
   $ psql -d "host=localhost dbname=postgres user=postgres application_name=$USER"
   psql (14devel)
   Type "help" for help.

   postgres=# SELECT application_name FROM pg_stat_activity WHERE pid=pg_backend_pid();
    application_name
   ------------------
    ibarwick
   (1 row)


Disclaimer: I have not applied any thought to any possible pitfalls and side
effects resulting from this approach.


Regards

Ian Barwick

-- 
Ian Barwick                   https://www.2ndQuadrant.com/
  PostgreSQL Development, 24x7 Support, Training & Services



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

Предыдущее
От: David Gauthier
Дата:
Сообщение: Re: passing linux user to PG server as a variable ?
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: passing linux user to PG server as a variable ?