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 1viFGz-001VDv-2i for pgsql-hackers@arkaria.postgresql.org; Tue, 20 Jan 2026 17:12:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1viFGy-0020K0-2E for pgsql-hackers@arkaria.postgresql.org; Tue, 20 Jan 2026 17:12:09 +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.96) (envelope-from ) id 1viFGy-0020Jo-16 for pgsql-hackers@lists.postgresql.org; Tue, 20 Jan 2026 17:12:08 +0000 Received: from fout-a1-smtp.messagingengine.com ([103.168.172.144]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1viFGw-001SCq-0P for pgsql-hackers@lists.postgresql.org; Tue, 20 Jan 2026 17:12:07 +0000 Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailfout.phl.internal (Postfix) with ESMTP id 5ADAEEC0255; Tue, 20 Jan 2026 12:12:05 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-06.internal (MEProxy); Tue, 20 Jan 2026 12:12:05 -0500 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 :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; t=1768929125; x=1769015525; bh=q 7XcRp7wHkQN6yrHKQuWkfAp7Sw5nMPlsxUxI3fvgyY=; b=ZzjoNeI9MjeBW2Q5f T3aehv4kPD4AuypR29V3Vz+u2UHyc8MCaI/RFJRpqouunlgBj4KzF6yVlxfu1pbJ ofDUmla3/2OwvP+BVPAMP7ThHReY7QbNAx8dU0rvenZkFLVhBLOtowDs7ynlLhaa fRFXevCqjkb2o2RZYxZLeuE1LsWMh3l+gqgj8ugNIa/N1Et67M2JeOrViXHfu8oI 0eYLSrnPQSRfjQCj3j5SpEqZY4R2yUPUTBfL/CDvTJETPr/iYM+S8GhOOpIv47ff 7Hprwa+fdqLcemW/jY5vb3TrwIVnN7Nzn13p4TXFJ7HvQbboXCwa0QeFsojm/LY/ Z8rlw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddugedtleejucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepfffhvfevuffkgggtugfgjgesthekredttddtjeenucfhrhhomheptehlvhgrrhho ucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgheqne cuggftrfgrthhtvghrnhepteejtdehuddutdethffhffekleefueetlefhffeigfeiieeh geeigfeiffejuedvnecuffhomhgrihhnpegvnhhtvghrphhrihhsvggusgdrtghomhdprg gtthhsohhfghhorhgurdgtohhmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghm pehmrghilhhfrhhomheprghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrghdpnh gspghrtghpthhtohephedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtoheprghnughr vghssegrnhgrrhgriigvlhdruggvpdhrtghpthhtohepvghulhgvrhesvghulhgvrhhtoh drtghomhdprhgtphhtthhopehlihdrvghvrghnrdgthhgrohesghhmrghilhdrtghomhdp rhgtphhtthhopehjrghpihhnlhhisehhohhtmhgrihhlrdgtohhmpdhrtghpthhtohepph hgshhqlhdqhhgrtghkvghrsheslhhishhtshdrphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 20 Jan 2026 12:12:04 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alvh.no-ip.org; s=schmee; t=1768929120; bh=/V9KHfYQ2ThOKKpOf8ovVGpic5TyRJQ5EoEiSJlsp/o=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=WJZvEME9T991XTv9HpuPImy9sSDfORRx2T3dsE7tWV6HT94HAsmVOV2DlyaB285oX lLo464zOWhtXwtI6/sX9sjIDO3y579l4t4ihskFsoIQDhQBj3nVVp6wEuRoJKCQToU YVUMgB/zB/1jHXvE2FvR8Vo4skV06Ed2puai3o10Ovvgn0JfdJ0MpqnZlMWlWy27wL UWyJCYKS8VDkiBrFeTeXhEzeVShWYmIah6NMg0Fxp2Pk84cGlPg31+vzJVKdbDey0N 7iEy0j1t0gyfz87Sqb9tEbT+qxtiVG6mSIyBxeBTbCu6n6b7t0K60cwso1xV994ZjG qfjn1tWp1KKDA== Received: by schmee.kurilemu.internal (Postfix, from userid 1000) id D520C7A; Tue, 20 Jan 2026 18:12:00 +0100 (CET) Date: Tue, 20 Jan 2026 18:12:00 +0100 From: Alvaro Herrera To: Euler Taveira Cc: japin , Andres Freund , pgsql-hackers@lists.postgresql.org, Chao Li Subject: Re: log_min_messages per backend type Message-ID: <202601201708.p3kmnsdyqdhq@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2026-Jan-15, Euler Taveira wrote: > @@ -1275,10 +1279,16 @@ check_log_min_messages(char **newval, void **extra, GucSource source) > char *rawstring; > List *elemlist; > ListCell *l; > + char *result; > + bool first = true; > int newlevel[BACKEND_NUM_TYPES]; > bool assigned[BACKEND_NUM_TYPES]; > int genericlevel = -1; /* -1 means not assigned */ > > + result = (char *) guc_malloc(LOG, MAX_LMM_STR_LEN); > + if (!result) > + return false; ... > + foreach(l, elemlist) > + { > + char *tok = (char *) lfirst(l); > + > + if (first) > + { > + strncpy(result, tok, MAX_LMM_STR_LEN); > + first = false; > + } > + else > + { > + strlcat(result, ", ", MAX_LMM_STR_LEN); > + strlcat(result, tok, MAX_LMM_STR_LEN); > + } > + } BTW I think this whole MAX_LMM_STR_LEN thing is unnecessary. It is probably easy enough to use a StringInfo to create the value iteratively, then once you know its final length do a guc_malloc() and strcpy the value there. -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/ "The Gord often wonders why people threaten never to come back after they've been told never to return" (www.actsofgord.com)