log_statement GUC parameter

From: Mladen Gogala <gogala(dot)mladen(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: log_statement GUC parameter
Date: 2021-08-12 20:19:18
Message-ID: 510207d8-8895-c3cb-e0a1-55135e4ce4f7@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi!

Unfortunately, only a superuser can set log_statement='all'; Would it be
possible to execute set session log_statement='all'; as an ordinary
user? I am trying to execute it from login.sql, a part of login_hook
extension which implements on-login triggers in PostgreSQL. I will
create a procedure with security definer, owned by the role "postgres",
and grant it to public. That should do the trick. However, it would be
much nicer if PostgreSQL allowed me to set the parameter as a part of
the normal session.

The idea is to log all statements by the particular user, not by
everybody. The user in question uses Weblogic 12.2.1.4  and creates a
connection pool so I need to find out which statements are the longest
running ones and make them perform.

Regards

--
Mladen Gogala
Database Consultant
Tel: (347) 321-1217
https://dbwhisperer.wordpress.com

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2021-08-12 20:23:08 Re: log_statement GUC parameter
Previous Message Magnus Hagander 2021-08-12 16:20:23 Re: Getting pg_stat_database data takes significant time