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 1mEHSD-00087A-Py for pgsql-general@arkaria.postgresql.org; Thu, 12 Aug 2021 20:37:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mEHSB-00078f-QW for pgsql-general@arkaria.postgresql.org; Thu, 12 Aug 2021 20:37:27 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mEHSB-00078X-HV for pgsql-general@lists.postgresql.org; Thu, 12 Aug 2021 20:37:27 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mEHS4-00009w-Nv for pgsql-general@lists.postgresql.org; Thu, 12 Aug 2021 20:37:27 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 17CKbGN74105998; Thu, 12 Aug 2021 16:37:16 -0400 From: Tom Lane To: Adrian Klaver cc: Mladen Gogala , pgsql-general Subject: Re: log_statement GUC parameter In-reply-to: References: <510207d8-8895-c3cb-e0a1-55135e4ce4f7@gmail.com> Comments: In-reply-to Adrian Klaver message dated "Thu, 12 Aug 2021 13:28:55 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <4105996.1628800636.1@sss.pgh.pa.us> Date: Thu, 12 Aug 2021 16:37:16 -0400 Message-ID: <4105997.1628800636@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk [ 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. regards, tom lane