pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Mladen Gogala <gogala.mladen@gmail.com>
Cc: pgsql-general <pgsql-general@lists.postgresql.org>
Subject: Re: log_statement GUC parameter
Date: Thu, 12 Aug 2021 16:30:12 -0400
Message-ID: <4105592.1628800212@sss.pgh.pa.us> (raw)
In-Reply-To: <510207d8-8895-c3cb-e0a1-55135e4ce4f7@gmail.com>
References: <510207d8-8895-c3cb-e0a1-55135e4ce4f7@gmail.com>

Mladen Gogala <gogala.mladen@gmail.com> 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 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.

If an ordinary user could manipulate that parameter, he could equally
well hide his activities from the system log.  Conversely, if the
postmaster log setup is such that not a lot of volume is expected,
then flooding it with extra traffic could create its own set of
problems.  Thus, basically all parameters that affect what is logged
are superuser-only, and it'd be a hard sell to weaken that.  The
SECURITY DEFINER function approach is your best bet for poking local
exceptions into that policy.

			regards, tom lane





view thread (9+ messages)  latest in thread

Message-ID: <4105592.1628800212@sss.pgh.pa.us>
Permalink:  ../4105592.1628800212@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/4105592.1628800212@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, gogala.mladen@gmail.com
  Subject: Re: log_statement GUC parameter
  In-Reply-To: <4105592.1628800212@sss.pgh.pa.us>
  References: <510207d8-8895-c3cb-e0a1-55135e4ce4f7@gmail.com> <4105592.1628800212@sss.pgh.pa.us>

* 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