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 1qLP9z-0031l3-AQ for pgsql-hackers@arkaria.postgresql.org; Mon, 17 Jul 2023 14:25:11 +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 1qLP9x-00AHcs-QA for pgsql-hackers@arkaria.postgresql.org; Mon, 17 Jul 2023 14:25: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.94.2) (envelope-from ) id 1qLP9w-00AHcj-SM for pgsql-hackers@lists.postgresql.org; Mon, 17 Jul 2023 14:25:09 +0000 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qLP9p-000unL-MI for pgsql-hackers@lists.postgresql.org; Mon, 17 Jul 2023 14:25:07 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 4A8B53200A39; Mon, 17 Jul 2023 10:24:56 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 17 Jul 2023 10:24:56 -0400 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:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1689603895; x= 1689690295; bh=NXCyoarbGgUFOUbjg/QLbMnK2OlfT7LoNlJrdJqGO2c=; b=c e0LLvkLGx/hh+5joaxTaqLSjitFd6zEzUsnOiyJ8c8Cr6/jVpBHPAbwqQvGi9RDf lNB+6b5DFb57VPoPM5rxdN/cVqqsi8mtZxakPbgXX9Wz33GN134veCdyQBa7gu8O kvQxjT+VCiH4hDBJXpRYD/ZHgzBkHiXKcI7fbQ45pzSHt5SYG4sfmQSyHinIcXku Q4ZSC0R3Y2/OwaSrlYdthbZKCtGt1ZZQlD/zQz4M+KrqSWpGl6/ZB/v8jqmDCsKs mPYEeU86OMujPZJXYzIvZcYcs52xcG8RcrpCic+CpudS3SJh7TBV7oWOsOL/WF0E rT4W9eJIYzUurp9gFerqA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrgedvgdejiecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvvefukfggtggugfgjsehtkeertddttdejnecuhfhrohhmpeetlhhvrghr ohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhgqe enucggtffrrghtthgvrhhnpedvkedtffduffdtffffheffhfejjefhgfeiueeukeejkeff gfdufffhudffffeuveenucffohhmrghinhepvghnthgvrhhprhhishgvuggsrdgtohhmne cuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghlvhhh vghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 17 Jul 2023 10:24:55 -0400 (EDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 56D239D; Mon, 17 Jul 2023 16:24:52 +0200 (CEST) Date: Mon, 17 Jul 2023 16:24:52 +0200 From: Alvaro Herrera To: Ashutosh Bapat Cc: Amit Kapila , Masahiko Sawada , Euler Taveira , pgsql-hackers@lists.postgresql.org Subject: Re: logicalrep_message_type throws an error Message-ID: <20230717142452.74yml7mfqkypfixp@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 2023-Jul-17, Ashutosh Bapat wrote: > Prologue of psprintf() says > > * Errors are not returned to the caller, but are reported via elog(ERROR) > * in the backend, or printf-to-stderr-and-exit() in frontend builds. > * One should therefore think twice about using this in libpq. > > If an error occurs in psprintf(), it will throw an error which will > override the original error. I think we should avoid any stuff that > throws further errors. Ooh, yeah, this is an excellent point. I agree it would be better to avoid psprintf() here and anything that adds more failure modes. Let's just do the thing in the original patch you submitted, to ensure all these strings are compile-time constants; that's likely the most robust. -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/ "Pensar que el espectro que vemos es ilusorio no lo despoja de espanto, sólo le suma el nuevo terror de la locura" (Perelandra, C.S. Lewis)