Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uuEaB-005Jhf-0a for pgsql-general@arkaria.postgresql.org; Thu, 04 Sep 2025 18:21:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uuEa9-001PmM-WE for pgsql-general@arkaria.postgresql.org; Thu, 04 Sep 2025 18:21:14 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uuEa9-001PmE-LW for pgsql-general@lists.postgresql.org; Thu, 04 Sep 2025 18:21:14 +0000 Received: from fhigh-b3-smtp.messagingengine.com ([202.12.124.154]) by makus.postgresql.org with smtp (Exim 4.96) (envelope-from ) id 1uuEa4-000Y96-0F for pgsql-general@lists.postgresql.org; Thu, 04 Sep 2025 18:21:12 +0000 Received: from phl-compute-09.internal (phl-compute-09.internal [10.202.2.49]) by mailfhigh.stl.internal (Postfix) with ESMTP id 730C27A0451; Thu, 4 Sep 2025 14:21:07 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-09.internal (MEProxy); Thu, 04 Sep 2025 14:21:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1757010067; x=1757096467; bh=dHUwRPYI3pU/dpmS1wC3Hzqr/T5xjCJ7OnCXrgyErpY=; b= WUikxJFETXYKY+dJiIZAcxrjZhL6aceCZF9TZGuFKrbzn6oWDXGbO2RRBc4ATTjk UtWX5lkKKKs1jsWgP4Xv/KMHKDT2m6ARcVJSE04AfWb9TrRP1Q9xl8KmiYw4TvvS QBZ/sXiSuR/pK2iT/sDm2oxSTEXo6LQ1rbiADIAOwoMYTmk/0+M3dGGsY4IrajJP 3N9aw1onVEezY9/tTy3RoLzbCaXmRXSmKfnJZ9GGoqiPOPuWWryjBjFx298mf+P0 J9uJTXSOpMOqc7pOZMTNfOiFHEmFa3hQPFzdpXW1fgEDvpVFbV0diCoi+9mcXsW0 i4yBdRrnyYIS503Kwx/p5g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1757010067; x= 1757096467; bh=dHUwRPYI3pU/dpmS1wC3Hzqr/T5xjCJ7OnCXrgyErpY=; b=X oVw6FZcIxyDpnzshsOUiVRXEoes6lzZpSXqcuyvraWtX5Q0OXemDi/QIrwNKk9JE sznwsKLkpzhNKxVj89waZS6q3mVeva1AN9tLkMFzaS6kV0cQGmWUZzRBY2Bq/aj3 lVVoQq6no0fxKvAJRkK8SWyBnAA9ZixKenaCDc8ugaMDQwo2mSr/C7ZedoaxjCFT AnG8Ak1rdrnoqfjljtaDLwhfkRgiACNiVwQ3p0Y6Ty1JjXGCrYOI6pwCLnqIjtSf 9FCCNHvjz48deLrT+fFWJfQLIwpO/m7ZNsh/VGheodqTfTIkLDOVXtjIE3MSX+nB Xb004RvYmaASt25ooR7sQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggdeijedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceurghi lhhouhhtmecufedttdenucenucfjughrpefkffggfgfuhffvvehfjggtgfesthekredttd dvjeenucfhrhhomheptegurhhirghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghv vghrsegrkhhlrghvvghrrdgtohhmqeenucggtffrrghtthgvrhhnpefgteehheekvdehud ffuedufeevgeehlefhvdfffeektdeujeetkeeffedvhfekleenucffohhmrghinhepphhs higtohhpghdrohhrghenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrih hlfhhrohhmpegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhmpdhnsggp rhgtphhtthhopeefpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopegrlhgsrhgvtg hhthdrughrvghsshesphhoshhtvghordguvgdprhgtphhtthhopehtghhlsehsshhsrdhp ghhhrdhprgdruhhspdhrtghpthhtohepphhgshhqlhdqghgvnhgvrhgrlheslhhishhtsh drphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 4 Sep 2025 14:21:06 -0400 (EDT) Message-ID: <6ec7306b-fa0d-49d1-9944-11cc934b7180@aklaver.com> Date: Thu, 4 Sep 2025 11:21:05 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Q: limit the length of log file entries? From: Adrian Klaver To: =?UTF-8?Q?Albrecht_Dre=C3=9F?= , Tom Lane Cc: pgsql-general@lists.postgresql.org References: Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 9/4/25 08:54, Adrian Klaver wrote: > On 9/4/25 08:48, Albrecht Dreß wrote: >> Am 03.09.25 21:07 schrieb(en) Tom Lane: >>> There isn't any provision for limiting the length of source queries >>> quoted in the log. >> >> I see, thanks for the clarification.  IMHO, it would be nice to have >> such an option, though… >> >>> Had your user sent the bytea value as a query >>> parameter, then log_parameter_max_length[_on_error] would have >>> applied, but this looks like the value was just inline in the query. >> >> I can confirm that the limitation is applied when I call >> PQexecParams() from a little c test application with the data included >> in the paramValues array.  The overlong log lines result from queries >> in a Python script using the psycopg2 module – no idea how this >> component formats the query. > > The best explanation is found from the psycopg(3) docs: > > https://www.psycopg.org/psycopg3/docs/basic/from_pg2.html > > Differences from psycopg2 > > "Psycopg 3 sends the query and the parameters to the server separately, > instead of merging them on the client side. Server-side binding works > for normal SELECT and data manipulation statements (INSERT, UPDATE, > DELETE), but it doesn’t work with many other statements. For instance, > it doesn’t work with SET or with NOTIFY:" As example: import psycopg2 import psycopg conpsyc2 = psycopg2.connect("dbname=test user=postgres") conpsyc3 = psycopg.connect("dbname=test user=postgres") cur2 = conpsyc2.cursor() cur3 = conpsyc3.cursor() cur2.execute("select * from csv_test where id = %s", [1]) cur3.execute("select * from csv_test where id = %s", [1]) yields: --cur2 2025-09-04 11:17:30.246 PDT [29695] postgres@test LOG: statement: BEGIN 2025-09-04 11:17:30.246 PDT [29695] postgres@test LOG: statement: select * from csv_test where id = 1 --cur3 2025-09-04 11:18:07.158 PDT [29703] postgres@test LOG: statement: BEGIN 2025-09-04 11:18:07.159 PDT [29703] postgres@test LOG: execute : select * from csv_test where id = $1 2025-09-04 11:18:07.159 PDT [29703] postgres@test DETAIL: Parameters: $1 = '1' > > >> >> Thanks again, >> Albrecht. > > -- Adrian Klaver adrian.klaver@aklaver.com