Re: log_statement GUC parameter

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: log_statement GUC parameter
Дата
Msg-id 20210812202308.GA4822@momjian.us
обсуждение исходный текст
Ответ на log_statement GUC parameter  (Mladen Gogala <gogala.mladen@gmail.com>)
Ответы Re: log_statement GUC parameter  (Mladen Gogala <gogala.mladen@gmail.com>)
Список pgsql-general
On Thu, Aug 12, 2021 at 04:19:18PM -0400, Mladen Gogala wrote:
> 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.

I think you can write a SECURITY DEFINER function that calls SET, call
that function at login.

-- 
  Bruce Momjian  <bruce@momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

  If only the physical world exists, free will is an illusion.




В списке pgsql-general по дате отправления:

Предыдущее
От: Mladen Gogala
Дата:
Сообщение: log_statement GUC parameter
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: log_statement GUC parameter