Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux