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 1mEHAm-0007g4-87 for pgsql-general@arkaria.postgresql.org; Thu, 12 Aug 2021 20:19:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mEHAk-0004eP-0Z for pgsql-general@arkaria.postgresql.org; Thu, 12 Aug 2021 20:19:26 +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 1mEHAj-0004dw-K7 for pgsql-general@lists.postgresql.org; Thu, 12 Aug 2021 20:19:25 +0000 Received: from mail-qt1-x82e.google.com ([2607:f8b0:4864:20::82e]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mEHAf-0003Gk-Tx for pgsql-general@lists.postgresql.org; Thu, 12 Aug 2021 20:19:24 +0000 Received: by mail-qt1-x82e.google.com with SMTP id y9so6325236qtv.7 for ; Thu, 12 Aug 2021 13:19:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:subject:message-id:date:user-agent:mime-version :content-transfer-encoding:content-language; bh=lqWfhm5WsJSYUo/NH6sNk3hnfOYBNUcc2KkqTg4AaSc=; b=b+sZ5y42VqKlK8YG3gdkMHHk1JKEEPab6R7FS8b7tKO2fv/nZd/i5lWuUy1tryeCfJ m3sJZrxPOALg2tKeplOm6Ixa0f+RI189t/Dh/5rVTzV5WPWUl4p3i/mKLONsPf7bN998 hrQuE6Vif06sVbSyqjlq7TLijEs45+ZT08W7EKpYxd/7gKJm0gGftsT9MrnTjODSKhkI xO4jY1OxbzwKht09Gy3TA52L6hzQl/xmki7z3FJq+4eC9HJGHiu7QRWR4zUZriqUP/nr /WYWNIVJV2i6GDU1NfmRqKqW53uJWP/9GP2L4BJdHY4N06Yg1Si+nL9zYvvzV8/c6/wg NT+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-transfer-encoding:content-language; bh=lqWfhm5WsJSYUo/NH6sNk3hnfOYBNUcc2KkqTg4AaSc=; b=alhXnY5hWqSszqIslRt1p7/jdb2RqJ7YAgW6PN8qgKYxc7MAVoJURccmXfluUSXuv6 XUSqsEMYNhO48VF3/50sN2tRqZoKmSX9KJ//svA4qyFMkQ/bX9WCNuO1lKyuGwx1VYA4 TRQ2dBJ0zOQum4FYmf4LlddjRLBMyx11idurDUGloDyCwBkHzsyj4ouNdr14Pm32gtSm CjPCCpVdAPBOjH5J64Vw6M/PHku5zIxErbPbA/adOgxWKFLWkQ8hY0audoB3CQoc9ygF cfiGW5s+u5OLGLhiXSp4fk9E2Qdl05aII7M7jyAtxXg1g2uCNLuu43VOIw4Tc0ToHvW/ QXnA== X-Gm-Message-State: AOAM531AGE9Luo3aoMdx1ej+ZOq1FkRdQchz6mayPvuuYq5Tti5RV55G PMlYuALPp4XFc/utCWJRgrG5L/qHcSz6Yw== X-Google-Smtp-Source: ABdhPJxTSbhTTDMkDzKKs+EPEZSQzBOMyzfMJGmjmpurmRNg2f117Xjsrk/GmfkbpmUDOSZSJxPxfw== X-Received: by 2002:a05:622a:50:: with SMTP id y16mr5737567qtw.322.1628799559047; Thu, 12 Aug 2021 13:19:19 -0700 (PDT) Received: from [192.168.2.100] (pool-100-8-54-81.nwrknj.fios.verizon.net. [100.8.54.81]) by smtp.gmail.com with ESMTPSA id n20sm2021402qkk.9.2021.08.12.13.19.18 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 12 Aug 2021 13:19:18 -0700 (PDT) To: pgsql-general From: Mladen Gogala Subject: log_statement GUC parameter Message-ID: <510207d8-8895-c3cb-e0a1-55135e4ce4f7@gmail.com> Date: Thu, 12 Aug 2021 16:19:18 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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. Regards -- Mladen Gogala Database Consultant Tel: (347) 321-1217 https://dbwhisperer.wordpress.com