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 1vO54N-0099fU-2o for pgsql-hackers@arkaria.postgresql.org; Wed, 26 Nov 2025 02:15:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vO54M-00DERh-1V for pgsql-hackers@arkaria.postgresql.org; Wed, 26 Nov 2025 02:15:46 +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 1vO54M-00DEQv-0Z for pgsql-hackers@lists.postgresql.org; Wed, 26 Nov 2025 02:15:46 +0000 Received: from fout-a8-smtp.messagingengine.com ([103.168.172.151]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vO54K-001Wc5-11 for pgsql-hackers@lists.postgresql.org; Wed, 26 Nov 2025 02:15:46 +0000 Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailfout.phl.internal (Postfix) with ESMTP id C4A43EC03F3; Tue, 25 Nov 2025 21:15:41 -0500 (EST) Received: from phl-imap-05 ([10.202.2.95]) by phl-compute-06.internal (MEProxy); Tue, 25 Nov 2025 21:15:41 -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=fm1; t=1764123341; x=1764209741; bh=ydtWwg3UChOtVWW48BDH9NNY41m9TavRM8RKtdf05Lc=; b= GXr9C7e0BE8hhmllw20z7O0eKVwwk1USgln2pRTLQEJeEPzL25gLHPU83DX9gc3S vYoz0p/xC+UywTGXNpDjuo99w6DyyqW5aMwnvg8XJc6HoFaQI4WPrgIKrktqExn2 50BAOqA3th/TM8CZplPeuXHX+b40v3gbdqd/jycAKf4KMrlHQ//GFXeUpYxHj8Ua I9s9eriLX46T94ej+MTyyPSW1XZ3c2E5UnGO1LTwBbhNqr38mDbormi2hrv0R3ok TMvWqdg74sbOjNh4sXZTvBki5uWhJ3xgyQapX9gNVwX0w6nDVSpyMNIQMXyS7tMz JffhO9OH+ngH86aMI/XouA== 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=fm3; t=1764123341; x= 1764209741; bh=ydtWwg3UChOtVWW48BDH9NNY41m9TavRM8RKtdf05Lc=; b=s bFa9OlVYzcbzbYLR/JcY7KsKWPNp29E3sZRJ9p+k/WYwV1kn8Uf6m/BKoulJggHn rjgFIrRKT0Ocn1NRPp0PPTYTq0ZqPbOYdPpBL+m3hCPVK1zi6mLAMOe5TLx31nmp Bk+TbMTOOinM5wppIi6bB2DojxZVvf7moAI4CwTj3ZhMC/NIrAgCkpwlDnLJxeeF 0UoT1zSMIZdYgjRpcf64L5yQhGn5+8+xeFX6QTN+14qXz/i9tc/jX4PUd/xMjQQ7 OkaWLvlmWkgeBTBXO8BSfWxtTUGXXsG0x7XVG/6qrzQK7zWnJLWxBjWxrM72UYJN vbk4sRoy61Zd/tM/0Qa4w== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggddvgeefuddvucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepofggfffhvfevkfgjfhfutgfgsehtqhertdertdejnecuhfhrohhmpedfgfhulhgv rhcuvfgrvhgvihhrrgdfuceovghulhgvrhesvghulhgvrhhtohdrtghomheqnecuggftrf grthhtvghrnhepfeekueejgeevteffueegffffgfefhedtgeduffejleduuedvhfeflefg jeegfeelnecuffhomhgrihhnpegvnhhtvghrphhrihhsvggusgdrtghomhenucevlhhush htvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegvuhhlvghrsegvuhhl vghrthhordgtohhmpdhnsggprhgtphhtthhopeehpdhmohguvgepshhmthhpohhuthdprh gtphhtthhopegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhgpdhrtghpthht oheprghnughrvghssegrnhgrrhgriigvlhdruggvpdhrtghpthhtoheplhhirdgvvhgrnh drtghhrghosehgmhgrihhlrdgtohhmpdhrtghpthhtohepjhgrphhinhhliheshhhothhm rghilhdrtghomhdprhgtphhtthhopehpghhsqhhlqdhhrggtkhgvrhhssehlihhsthhsrd hpohhsthhgrhgvshhqlhdrohhrgh X-ME-Proxy: Feedback-ID: i0c21471d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 53DDC1820054; Tue, 25 Nov 2025 21:15:41 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface MIME-Version: 1.0 X-ThreadId: AGl55nTq-Okk Date: Tue, 25 Nov 2025 23:15:21 -0300 From: "Euler Taveira" To: "Chao Li" Cc: japin , "Alvaro Herrera" , "Andres Freund" , pgsql-hackers@lists.postgresql.org Message-Id: In-Reply-To: <8AF30EAA-2E9F-4398-B4C6-24C4480CA869@gmail.com> References: <202507311651.ahhz57cfk6lo@alvherre.pgsql> <24b9bfd6-7fba-4946-9b73-244934b89464@app.fastmail.com> <72e809ff-c842-4f98-93f1-26a3cb3d92d0@app.fastmail.com> <8AF30EAA-2E9F-4398-B4C6-24C4480CA869@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 Thu, Nov 6, 2025, at 11:53 AM, Chao Li wrote: > I just reviewed the patch and got a few comments. > Thanks for your review. > + /* Initialize the array. */ > + memset(newlevel, WARNING, BACKEND_NUM_TYPES * sizeof(int)); > ``` > > I think this statement is wrong, because memset() writes bytes but=20 > integers, so this statement will set very byte to WARNING, which shoul= d=20 > not be the intention. You will need to use a loop to initialize every=20 > element of newlevel. > Facepalm. Good catch. > 2 - variable.c > ``` > + /* Parse string into list of identifiers. */ > + if (!SplitGUCList(rawstring, ',', &elemlist)) > + { > + /* syntax error in list */ > + GUC_check_errdetail("List syntax is invalid."); > + guc_free(rawstring); > + list_free(elemlist); > + return false; > + } > ``` > > Every element of elemlist points to a position of rawstring, so it=E2=80= =99s=20 > better to list_free(elemlist) first then guc_free(rawstring). > Fixed. > 3 - launch_backend.c > ``` > static inline bool > should_output_to_server(int elevel) > { > - return is_log_level_output(elevel, log_min_messages); > + return is_log_level_output(elevel, log_min_messages[MyBackendType]); > } > ``` > > Is it possible that when this function is called, MyBackendType has no= t=20 > been initialized? To be safe, maybe we can check if MyBackendType is 0=20 > (B_INVALID), then use the generic log_min_message. > It uses the generic log level if you don't modify backend type "backend"= . If you do specify "backend", that level is used instead. After Alvaro's que= stion in the other email, I added "postmaster" backend type and assigned it to B_INVALID. That's exactly the log level that will be used. As I said in = that email, it is ok to consider a process whose backend type is B_INVALID as= a postmaster process. > * =E2=80=9CValid values are =E2=80=A6=E2=80=9D, here =E2=80=9Care=E2=80= =9D usually mean both are needed, so=20 > maybe change =E2=80=9Care=E2=80=9D to =E2=80=9Ccan be=E2=80=9D. > * It says =E2=80=9Cthe single level is mandatory=E2=80=9D, then why th= ere is still a=20 > default value? > It seems the current sentence that describe the comma-separated list is ambiguous. The sentence doesn't make it clear that the list contains 2 e= lements (type:level and level) and the "level" element is mandatory. What about = the new sentence? --=20 Euler Taveira EDB https://www.enterprisedb.com/