Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mEHUr-0008BA-4I for pgsql-general@arkaria.postgresql.org; Thu, 12 Aug 2021 20:40:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mEHUq-0003Tv-4c for pgsql-general@arkaria.postgresql.org; Thu, 12 Aug 2021 20:40:12 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mEHUp-0003Tb-SH for pgsql-general@lists.postgresql.org; Thu, 12 Aug 2021 20:40:11 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mEHUn-0003QO-LR for pgsql-general@lists.postgresql.org; Thu, 12 Aug 2021 20:40:10 +0000 Received: from bruce by momjian.us with local (Exim 4.92) (envelope-from ) id 1mEHUl-0001qU-Tt; Thu, 12 Aug 2021 16:40:07 -0400 Date: Thu, 12 Aug 2021 16:40:07 -0400 From: Bruce Momjian To: Tom Lane Cc: Adrian Klaver , Mladen Gogala , pgsql-general Subject: Re: log_statement GUC parameter Message-ID: <20210812204007.GC4822@momjian.us> References: <510207d8-8895-c3cb-e0a1-55135e4ce4f7@gmail.com> <4105997.1628800636@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4105997.1628800636@sss.pgh.pa.us> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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?: > > 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 https://momjian.us EDB https://enterprisedb.com If only the physical world exists, free will is an illusion.