On Thu, Aug 12, 2021 at 04:37:16PM -0400, Tom Lane wrote:
> [ dept. of second thoughts ]
>
> Adrian Klaver <adrian.klaver@aklaver.com> writes:
> > On 8/12/21 1:19 PM, Mladen Gogala wrote:
> >> The idea is to log all statements by the particular user, not by
> >> everybody.
>
> > Would pg_stat_statements work for you?:
> > https://www.postgresql.org/docs/current/pgstatstatements.html
>
> Actually, for that specific requirement, there's an easier way:
>
> ALTER USER target_user SET log_statement = 'all';
>
> While the target_user can't do that for himself, a superuser
> can.
Ah, yes, I hadn't considered that ALTER USER bypasses those user checks.
--
Bruce Momjian <bruce@momjian.us> https://momjian.us
EDB https://enterprisedb.com
If only the physical world exists, free will is an illusion.