Re: log_statement GUC parameter

2021-08-12 Thread Mladen Gogala
Thank you Tom! It turns out that the Oracle way of doing things (SECURITY DEFINER) was the wrong way here. Thanks a bunch. On 8/12/21 4:37 PM, Tom Lane wrote: ctually, for that specific requirement, there's an easier way: ALTER USER target_user SET log_statement = 'all'; While the tar

Re: log_statement GUC parameter

2021-08-12 Thread Mladen Gogala
Hi Bruce Yes, I can. I have already done so and it works. I wrote a procedure because of my Oracle background, but it doesn't really matter. This was just a suggestion for the session settable parameters. Regards On 8/12/21 4:23 PM, Bruce Momjian wrote: I think you can write a SECURITY DEFI

Re: log_statement GUC parameter

2021-08-12 Thread Bruce Momjian
On Thu, Aug 12, 2021 at 04:37:16PM -0400, Tom Lane wrote: > [ dept. of second thoughts ] > > Adrian Klaver 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?: > >

Re: log_statement GUC parameter

2021-08-12 Thread Tom Lane
[ dept. of second thoughts ] Adrian Klaver 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, fo

Re: log_statement GUC parameter

2021-08-12 Thread Bruce Momjian
On Thu, Aug 12, 2021 at 04:30:12PM -0400, Tom Lane wrote: > Mladen Gogala writes: > > 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 log

Re: log_statement GUC parameter

2021-08-12 Thread Tom Lane
Mladen Gogala writes: > 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 Postgre

Re: log_statement GUC parameter

2021-08-12 Thread Adrian Klaver
On 8/12/21 1:19 PM, Mladen Gogala wrote: Hi! 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. Wo

Re: log_statement GUC parameter

2021-08-12 Thread Bruce Momjian
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 w

log_statement GUC parameter

2021-08-12 Thread Mladen Gogala
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 pro