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