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.96) (envelope-from ) id 1vTVwn-003cEC-1a for pgsql-hackers@arkaria.postgresql.org; Thu, 11 Dec 2025 01:58:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vTVwl-001qcn-2Y for pgsql-hackers@arkaria.postgresql.org; Thu, 11 Dec 2025 01:58:24 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vTVwl-001qcf-1b for pgsql-hackers@lists.postgresql.org; Thu, 11 Dec 2025 01:58:24 +0000 Received: from fout-a6-smtp.messagingengine.com ([103.168.172.149]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vTVwj-00053C-2K for pgsql-hackers@lists.postgresql.org; Thu, 11 Dec 2025 01:58:24 +0000 Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailfout.phl.internal (Postfix) with ESMTP id 8EB40EC0515; Wed, 10 Dec 2025 20:58:20 -0500 (EST) Received: from phl-imap-05 ([10.202.2.95]) by phl-compute-06.internal (MEProxy); Wed, 10 Dec 2025 20:58:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eulerto.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=fm2; t=1765418300; x=1765504700; bh=PaDsfNxexBUUZ4HDOtZHxtGalRpz00t+NLh11a+UPgw=; b= io5IVDR07lXtu1fJw+69shKydVnDErRy6gCkhuoOnVv1OERmFEcKNlTgo4h2c3TY kdx3zTC+Ad1hZtvgAKWrpSI5kXrk4T0BPaGjS6Ohq0JQyW17HmxLTNgrsUG1CzRP Y8ajHYCD2wnDpqKj1q8ITfSJoS1ERv4fDUT4B0b8FRAOpIhzgaWlSHXTHbaFVQeE UWPI87J0QBHE0jjYjY4HV4LReuUhVVO6rMtuFDzBCm3zzRvnYfE550/8E7avwnY2 dnkdRMuI33O1A+4e9R9bzxBq4vEr/oaAUVxCqDmM17WbtvdDONlLlBMpk8oIDglz JZ/OKW7w1faK9/eH+exROg== 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=1765418300; x= 1765504700; bh=PaDsfNxexBUUZ4HDOtZHxtGalRpz00t+NLh11a+UPgw=; b=T ZxmSSOFx4JeJY0ZTKaKz4IaVfCMfhKvyi4CX0v3zXilyg4RkIDLkjIY8mPox3GBC oiSW+ACAUzPZdvZ5HL4EMPcl7UU5IjsV9ba+MCQI0o2YN5AXP1DrKgKJPmRsH1MM WHYCKL1uIeVDbSlMr6dzmS/DFzSFhtSrTBt83rDHsKkwxsm7JrfhcpsFgkMw2z5P bGz/nP4u+v38Zco5Z4tfH4WSESMV2qckDSZTisBKtbfGHOSWb3JOQFN8ZDrDpSA9 4Mc2SaDWDMmQcQBt7cRy5Co7fM1rS6tK6s1/s5LTFHEwUH7rt+twG8JZGlDYnrBT rknwOKgjQZ+rgs36M5+hg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddvgedthecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpefoggffhffvvefkjghfufgtgfesthhqredtredtjeenucfhrhhomhepfdfguhhlvghr ucfvrghvvghirhgrfdcuoegvuhhlvghrsegvuhhlvghrthhordgtohhmqeenucggtffrrg htthgvrhhnpeefkeeujeegveetffeugefffffgfeehtdegudffjeeludeuvdfhfeelgfej geefleenucffohhmrghinhepvghnthgvrhhprhhishgvuggsrdgtohhmnecuvehluhhsth gvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepvghulhgvrhesvghulhgv rhhtohdrtghomhdpnhgspghrtghpthhtohephedpmhhouggvpehsmhhtphhouhhtpdhrtg hpthhtoheprghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrghdprhgtphhtthho pegrnhgurhgvshesrghnrghrrgiivghlrdguvgdprhgtphhtthhopehlihdrvghvrghnrd gthhgrohesghhmrghilhdrtghomhdprhgtphhtthhopehjrghpihhnlhhisehhohhtmhgr ihhlrdgtohhmpdhrtghpthhtohepphhgshhqlhdqhhgrtghkvghrsheslhhishhtshdrph hoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: i0c21471d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 130491820074; Wed, 10 Dec 2025 20:58:20 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface MIME-Version: 1.0 X-ThreadId: AGl55nTq-Okk Date: Wed, 10 Dec 2025 22:57:51 -0300 From: "Euler Taveira" To: "Chao Li" , "Alvaro Herrera" Cc: japin , "Andres Freund" , pgsql-hackers@lists.postgresql.org Message-Id: <3d0af6b2-15d1-4f38-9881-df964ba0a89b@app.fastmail.com> In-Reply-To: <1130A10B-E7AE-49F3-9E13-2CD69B3F9DFD@gmail.com> References: <202512091806.bsugq2l4wz7f@alvherre.pgsql> <1130A10B-E7AE-49F3-9E13-2CD69B3F9DFD@gmail.com> Subject: Re: log_min_messages per backend type Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Dec 9, 2025, at 11:00 PM, Chao Li wrote: > Now =E2=80=9Cshow log_min_messages=E2=80=9D prints the raw string the = user set, in=20 > above example, there is not a white-space between the two log levels,=20 > and =E2=80=9Cshow=E2=80=9D result doesn=E2=80=99t have a white-space b= etween the two log levels=20 > either. IMO, =E2=80=9CSHOW log_min_messages=E2=80=9D should display a = stable result, in=20 > other words, say =E2=80=9Cfatal, backend:log=E2=80=9D and =E2=80=9Cbac= kend:log, fatal=E2=80=9D should=20 > show the same result as they are actually meaning the same. So, I woul= d=20 > suggest normalize the raw string: put the general level in the first=20 > place and sort others by process type, then SHOW returns the normalize= d=20 > string. > I thought about it but leave it alone because (a) it would increase this= patch footprint and (b) the input might be different from the output. I could = also be done in another patch but under reflection an unstable output can break = tests or whatever uses the SHOW log_min_messages output. I thought this change= would require a new show_log_min_messages to manipulate the input again but we= can reassign the GUC value after sorting the existing list and creating a ne= w string list. > In the =E2=80=9Cif=E2=80=9D and =E2=80=9Celse=E2=80=9D clauses, there = are duplicate code to valid log=20 > levels. We should refactor the code to avoid the duplication. For=20 > example, pull up =E2=80=9Cloglevel=E2=80=9D to the =E2=80=9Cfor=E2=80=9D= loop level, then we can valid=20 > it after the =E2=80=9Cif-else=E2=80=9D. > The for loop is duplicate but if you create a separate function for it b= ut the result is: src/backend/commands/variable.c | 43 ++++++++++++++++++++++------------= --------- 1 file changed, 22 insertions(+), 21 deletions(-) I'll post a patch in a couple of hours after spend more time in it. --=20 Euler Taveira EDB https://www.enterprisedb.com/