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 1x0vJ5-004szP-03 for pgsql-hackers@arkaria.postgresql.org; Mon, 31 Aug 2026 06:15:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1x0vJ3-00Fm9W-39 for pgsql-hackers@arkaria.postgresql.org; Mon, 31 Aug 2026 06:15:45 +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 1x0vJ3-00Fm9O-21 for pgsql-hackers@lists.postgresql.org; Mon, 31 Aug 2026 06:15:45 +0000 Received: from fout-b7-smtp.messagingengine.com ([202.12.124.150]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1x0vJ0-000000028yP-3vQR for pgsql-hackers@postgresql.org; Mon, 31 Aug 2026 06:15:45 +0000 Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42]) by mailfout.stl.internal (Postfix) with ESMTP id A907F1D00119; Mon, 31 Aug 2026 02:15:39 -0400 (EDT) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-02.internal (MEProxy); Mon, 31 Aug 2026 02:15:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc: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=1788156939; x=1788243339; bh=gZ2RT0ypuV oKmwbN/hfAEW9a98axeiKKiY3h9I3Kn1k=; b=EqWoPtOvk4+2fp7xFoEuTC37cu YjsgtSwrQU/5cY2Yi5qdExuOIa9hIsp5sxcsfrbBRhtIV2LSkF3kY6hfnivetVLF 7z1qOafq1b+xMJ2VKGCW9OYzmC2H2HpMi5Rsx3oifoNFhEnOaJFSeiuDf0DNyQcx YvRURINe6R+uNXMkIKR25rMZyt+gkp/cRCy+FyCH6N1LNuIV8h5x7AsQoxOgfXGI q0heXoORYf0qi7X3P4+dpkMc4YtYh6ywbNlmWkuxNxlbvpYaDwq6nB/crKbjR+/f KOhmDJlkABg0heVg9KzSEC6S/v4S0ZlR6eZgcKs/Lsi1YJFWEs0V/dP2xEog== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc: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= 1788156939; x=1788243339; bh=gZ2RT0ypuVoKmwbN/hfAEW9a98axeiKKiY3 h9I3Kn1k=; b=Ds+T1/RBQ8QLzqYQMHZbAvgf6HW0aomJdLPm+R9CpjhA2I6hlou 1a0RdrZsdNmnhwnVWdE1S72AvwTMFU8CW8OMXgyhjNjy0PRXWMXo8WrKU+8Jdpv0 V3pG7zJEinP6lBvfvrjv58/XQiuO4P8KpeNuqKWJkh5yWJ1yM0tC6UtPBJF+Z5wI hPsoKXemsMhgydh/dMU5n9EOqQO+JOSbaUvUYuCKO1dan7+vVsfraXSR1BNcpP3x B8XQ18uooVFV7K1Rhdb7CFKGT7c8HCqiNB0SG4zmkDu2OxI9BdPoGzhWlNzwMWpn xPfCCuHyy+aB7iH9agMgAaPPse/KQ6xUYWg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: dmFkZTFAwJabrK2mCuXI7lQQtscegqH0fAiAk4rFaYVJW91BkK4h9EXzkuL6KpDMH056Fk braFqFJX9j6ke+TJ1KzoIGGRLc2p/cyGGBmxJpmuf01aYPFTC0EWT6H7oi04KDKjaXcQsP mhAUXxbGKHo46+9P6QY1MX9CUnFTxX9HxJs0X091zcA77ryPx6RmHOor8/8yLAr63OBrC9 SADbUh7GEqpw7tdsaGzWqik9G3X2nVswwjSpPEGyHqVeALbuWQ+AYw+NfGi7wbZ7CIpaYT K/xkci+ttkMnmIupfpOfeSgCQFWCJPPORAlpRrZpbgFS5scrK3bSJK22m+lwKwYPMgL+PP 3zsevIT/awwlV7c4hvdSanH81ijOd8t+9LcNn6DNaBYuxaA91SalcPKugXb57AwohnlKoD +XQwofQwR1JwksXxo3USmrMqlsz3uZnfQsHIB24g0SABLAhlgnv/v1sNx2RRUo+5Rg0kiD m8ofui4kBa7uIPowxMy/m336A/KXAqd4GerPKtPdiahRHNv0ow2nSNPGqOPlnJcnYlQtTd 4u3Fkpree1yZtQXJ2Y2yrsxhqvSKd3kzBKfbMfaLHyBh+GWdXZbWpvrCEh7SAtQiEKS7Gv NmxlhlyzzDiWkW39gmYzc7PQ2gxDToYymmJXvn/HK8cnnNidPQNygChC5xqw X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 31 Aug 2026 02:15:37 -0400 (EDT) Date: Mon, 31 Aug 2026 15:15:33 +0900 From: Michael Paquier To: Alexander Lakhin Cc: Andres Freund , Tom Lane , pgsql-hackers , Justin Pryzby Subject: Re: Internal error codes triggered by regression tests and user queries, take 2 Message-ID: References: <94ac928b-8370-4db5-ada5-579a9ebc089d@gmail.com> <697477.1787754418@sss.pgh.pa.us> <73eb724a-c1a3-456c-be12-0375d4556b67@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="EnMB0nyVv/Psz+Sa" Content-Disposition: inline In-Reply-To: <73eb724a-c1a3-456c-be12-0375d4556b67@gmail.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --EnMB0nyVv/Psz+Sa Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Aug 28, 2026 at 03:00:00PM +0300, Alexander Lakhin wrote: > I agree. The fact that the internal error is reached from a legal SQL-lev= el > function doesn't make all other ways to reach it expected/normal. This is > one issue with this proposal. Not all of them are. See below for details. Looking (finally) at the list you have sent in your patch, I can get on board for: - getObjectDescription(), can be queried with a function officially documented. - ATPrepAddPrimaryKey(). This one is a bug to me, reachable with SQL. - transformColumnDefinition(). Also a bug to me. - pg_get_shmem_allocations_numa. Bug. - acldefault() is documented. Seems worth fixing for correctness, documented function. - AdjustIntervalForTypmod(). Documented feature. - The pl_gram.y one looks like a defect to me by not assigning an error code. But not for these: - relation_open(), incorrect internal state from the caller. - try_relation_open(), incorrect internal state from the caller. coerce_type(), also an internal state. unknownin() is also an - "internal" input, non-documented SQL function. - check_float8_array(). Your case involves float8_regr_intercept(), which is a final aggregate function. It is not documented, and should never really be called directly. - get_range_io_data(). Cannot get excited about this one, either, as your case involves the direct call of an input function. Can this happen with more patterns? - test_pglz_decompress() is test code, no need to worry about it. > The other one is the unclear definition of internal/XX000 errors in > principle. As far as I can see, it varies from "all the errors that have > no specific code assigned" to "critical errors, similar to failed asserts" > (and probably a substitute for asserts in production). And as Andres (and > I too) find it useful to search for XX000 in production logs, it means > they are interpreted per the second definition. In this case, it makes > sense to define missing codes for cases which are not worth paying > attention to in production, e.g. "#print_strict_params XXX". Moreover, if > the second definition (XX000 error ~ failed assert) is going to be > accepted, it seems sensible to have no such errors produced during > regression tests (like no assertion failures). I think that I would draw a line depending on the documentation. If a function is documented as usable, or callable through a view, it sounds fair to me to assume that a user gets an error code that fits with the incorrect behavior provided as input argument. Input function for types, test code, direct function calls to embedded facilities like aggregates, or anything like that, not documented, is not worth bothering. The fact that none of them is documented is an argument good enough for me to state that we don't really expect users to use these this way. The important piece to keep in mind is that non-internal ereport() calls mean translation. There is no point in providing translation for states that we expect users to never see in the field, and the docs define what we make user-visible. > I would elaborate on these when the consensus on the definition is reache= d. >=20 > [1] https://www.postgresql.org/message-id/flat/ba76c6bc-f03f-4285-bf16-47= 759cfcab9e%40eisentraut.org > [2] https://www.postgresql.org/message-id/Zic_GNgos5sMxKoa%40paquier.xyz Among the 13 patterns you have sent, 7 of them make sense to me as being reachable through documented patterns, 6 are not. As far as I can see, Andres seems to me roughly among the same line, except for get_range_io_data() that I disagree with as not reachable by normal (aka documented) means based on the information provided. Among the 7 patterns worth fixing, I'd suggest either improvements to the error messages, or even better: check if we could reuse any of the existing error messages already translated. -- Michael --EnMB0nyVv/Psz+Sa Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmqVHAUACgkQnvQgOdby QH2yUxAAhv490sG00bgnIDqv2igL11SWnjmOlR231A2jVxjgnm/BhTIaj7EW6DLk oxhyd8fHAo5fSbs9b+96/3VEs2svlagXwsUf387JQ+tUQwvCe6SYW1tZqkoxsOo8 OmANPapHPsZIMpJCjC9Re+TL1+ARKJ3tbGa0427vSzfAcAXELrFup8lZxDRn9mbN ccsetRquMId5ti7K3ZKGBY9JGmrbH34U06BpXJaXESrrfzytB2Oxj5j4jZH5pw1N ajtTV+XnbNah57vPrL1+owr4NF0p+QS3rdbIbxXnKyoOTN2YyX1yqWG9xi5hqqa6 Mp427fpV2/+/B6TTB4Uje4dszuqOM1fyN8wCcfZVYDeiKpxtHcQaqKVQOK6Bp2Mo 1g+n9Thay3sdY6fCambFi7j9CsvxaWm1jfql1fd4m1rYx8ZacmAi1WEUE4dEhyYN ekAVgTs+uiNgAPbmw97ENB33CpxSxBSDaUqIesoY/mn9qF6FuqgB/XQ3W5AHpSwx eo2eAxRJ4fhshzkyzF6yFoFAGz/FMGqWw3dLVQ36YKVRCsKmz1AJPqGZQ17S1hN4 0yATmcaQwFJ/GvzV5Rs6wiazRqJW99nVt/mw6QfMg6dbVfRiIo9ktFWiYcL0Ssid BR94DYDzPIeuK13FWUv2ylHYP5PtZ8EO4nHGbITAz6m8OZkLLgc= =tSUA -----END PGP SIGNATURE----- --EnMB0nyVv/Psz+Sa--