pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Marcos Pegoraro <marcos@f10.com.br>
To: Postgres General <pgsql-general@postgresql.org>
Subject: Re: get user info on log
Date: Thu, 15 Sep 2022 08:59:48 -0700
Message-ID: <dff2c688-e652-8561-890e-e783c15c8686@aklaver.com> (raw)
In-Reply-To: <CAB-JLwYR8EQFepAuvBm2MPG9oWh1xXUR_deXguQYu4ijJNgAdg@mail.gmail.com>
References: <CAB-JLwYR8EQFepAuvBm2MPG9oWh1xXUR_deXguQYu4ijJNgAdg@mail.gmail.com>

On 9/13/22 12:45, Marcos Pegoraro wrote:
> When using set role or set session authorization and an error occurs I 
> get user name which logged in and not the one I´ve changed to.
> 
> There is a way to get session_user and current_user on log ?

When I do:

test(5432)=# set role maura;
ERROR:  role "maura" does not exist
test(5432)=# SET SESSION AUTHORIZATION 'maura';
ERROR:  role "maura" does not exist


I get:

psql-postgres-2022-09-15 08:53:41.204 PDT-0ERROR:  role "maura" does not 
exist
psql-postgres-2022-09-15 08:53:41.204 PDT-0STATEMENT:  set role maura;
psql-postgres-2022-09-15 08:55:26.325 PDT-0ERROR:  role "maura" does not 
exist
psql-postgres-2022-09-15 08:55:26.325 PDT-0STATEMENT:  SET SESSION 
AUTHORIZATION 'maura';

in the logs.

Are you not seeing that or do you want something different?

If you want something different then you will need to provide a more 
detailed description of what that is.

> 
> Thanks
> Marcos


-- 
Adrian Klaver
adrian.klaver@aklaver.com





view thread (6+ messages)  latest in thread

Message-ID: <dff2c688-e652-8561-890e-e783c15c8686@aklaver.com>
Permalink:  ../dff2c688-e652-8561-890e-e783c15c8686@aklaver.com/
Also on:    postgresql.org/message-id/dff2c688-e652-8561-890e-e783c15c8686@aklaver.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, marcos@f10.com.br
  Subject: Re: get user info on log
  In-Reply-To: <dff2c688-e652-8561-890e-e783c15c8686@aklaver.com>
  References: <CAB-JLwYR8EQFepAuvBm2MPG9oWh1xXUR_deXguQYu4ijJNgAdg@mail.gmail.com> <dff2c688-e652-8561-890e-e783c15c8686@aklaver.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox