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.98.2) (envelope-from ) id 1xA1ri-00000002Pct-2o7A for pgsql-hackers@arkaria.postgresql.org; Fri, 25 Sep 2026 09:05:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xA1rh-0000000HX5z-1tGm for pgsql-hackers@arkaria.postgresql.org; Fri, 25 Sep 2026 09:05: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.98.2) (envelope-from ) id 1xA1rg-0000000HX5r-3Mu2 for pgsql-hackers@lists.postgresql.org; Fri, 25 Sep 2026 09:05:09 +0000 Received: from fout-a3-smtp.messagingengine.com ([103.168.172.146]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xA1re-00000001Alg-0WIV for pgsql-hackers@lists.postgresql.org; Fri, 25 Sep 2026 09:05:07 +0000 Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfout.phl.internal (Postfix) with ESMTP id DB25DEC0110; Fri, 25 Sep 2026 05:05:05 -0400 (EDT) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-05.internal (MEProxy); Fri, 25 Sep 2026 05:05:05 -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=fm1; t=1790327105; x=1790413505; bh=T63cHx2nJ4 6AfbgOsmKhrhAXX04rRIr1nU+nD7pQJIU=; b=Ogne7cJ4BsmWQU2HkRMe//R2U3 SyZ54QIyQJoXrP4MEX4WmM7E310ebaXCNg4Cn6S8FGk0ZLBJRJFt2qwyXIxWPulM bTZuu1ARL15nzEioSll/WjgDXmBZFnFg6DlTCVhz4ofLgTrqW2DTt1Onz4bVthlW r8XkxBjShVdkIzi42CtMpGeNgXG+cPhA/aGZ5t+qj8NqdP8OrRG9xoZoiX40GLB8 ayWShwWpe/WqFL22KT8WqHouXaeEnRtkhxoBSDC06UZN9XjQsAEKs6klk3/H+rIt 669e2fUDHYh046+ilhGEh7+GsTqO7DykZlnrOzzB25vMSNKNLwlELssNIT2g== 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=fm1; t= 1790327105; x=1790413505; bh=T63cHx2nJ46AfbgOsmKhrhAXX04rRIr1nU+ nD7pQJIU=; b=N0ZKQZ2xTTV7p5csIuE7kDoySCGIuuI3RCS2Ma3EJQ6abo/Uwns SRUjkNiMyI5s/1bAr2fQEVv49R7pWU3EIV8J0aXpHkL1A+qi0s2lhCdfph037HRe Ti+gAvQ5cZPv1iGtgWdRjX9A4/Se/hG///TgP6LpIOHAPcCL7gPa58EHiYvvNFhV MSN0gmc9yFSiJbAE63H4YWYr3WRff5uigPA/zR977CORA5Dfpk5dQertnTFGw2dG YLaflbBdXsFREt5hjEdO/eOUW2g3s36ej6vSs6nrpmbct/6WHetnyoHMSeKZNLT6 JFZRmVaKCuM5xKDMGJEkUabbSFIfG3bOI0g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: dmFkZTF9rtfsS2J6uzQjf2QwDc1CAAvtfr6FJmqHanlJRqDLIoyszbuGdsubhjp3nfJAt7 juqUnyDcby/ng0dHjYnu0dlzMKpqM9cjZ5i+wI/LM6T2Cc3jwILYlBl0jV/ITzTTw0Ewac sWFQEhW33vmcmQnf9j3JwQhdz9JsifgReX+p3sRyIcGC5RGtx//68mEQu2zExswrv2pnSA pOnxHLsJbSBYDeC+m8/oPh+8EnTSjTZ85GZLBGs0BkzrDscwFbK3oO6zmFGLvzoeo/Nys9 IF9IX4LRvXFR7SNtAjL+AJch0YsPHPu4l910yt7ANPx9DH1+UZGQl/VLtQ5uYoiBentUn2 xauRHjVnwU1fWdSnYcM7cZBVw4camewmvFUcfm18bfTmt6lv3J1Ovga4TbZxixEY8gVApy hNKmujK/sL8I6gyoCUxLI+nnQVj7CEdIH5zwt/BtSkvuQFo3PJNGTmIm/7Z1zG1JOuk41A Rx1U8CG5JpLrLhO7bqOLVrf0FlsNDhUkrjXtjy3VKv342a/4ImyvZT6GRKdcziO8PcAxUQ MM+LoD4jOOYQXE+UCSzd7eYgwXQm+UlztUoR99U6NCkMayH7jMS3/U2X4ehG5w/Oe7eI2V qCQ1jrDwqZhblRvcRcGiiURhSimSvcdneDjlRUsM4cvB7a8bmjI+p93D0vpw X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 25 Sep 2026 05:05:04 -0400 (EDT) Date: Fri, 25 Sep 2026 18:04:40 +0900 From: Michael Paquier To: Bertrand Drouvot Cc: Matthias van de Meent , PostgreSQL Hackers Subject: Re: BUG: pg_class.relchecks overflow, making table undroppable Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="Wy8dRiS/r7JiD+y4" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --Wy8dRiS/r7JiD+y4 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Sep 25, 2026 at 08:41:38AM +0000, Bertrand Drouvot wrote: > Just a few comments: >=20 > =3D=3D=3D 1 >=20 > It needs a rebase due to 926627bf902 >=20 > =3D=3D=3D 2 >=20 > + ereport(ERROR, > + errmsg("too many check constraints on relati= on \"%s\"", > + RelationGetQualifiedRelationName(rel)= )); >=20 >=20 > I think ERRCODE_PROGRAM_LIMIT_EXCEEDED would be appropriate here? An error record would be appropriate, yes. That's reachable with SQL. > numchecks++; > + > + if (numchecks >=3D PG_INT16_MAX) > + ereport(ERROR, > + errmsg("too many check constraints on relati= on \"%s\"", > + RelationGetQualifiedRelationName(rel)= )); >=20 > I wonder if it wouldn't make more sense to check numchecks >=3D PG_INT16_= MAX before > calling StoreRelCheck()? That would avoid inserting the constraint, recor= ding its > dependencies and invoking the post create hook for an object that will be= rejected. Yeah, let's do that. That's unlikely but it would just be a waste and that's just switching the order of things. If somebody is willing to send an updated patch, feel free, I don't have the energy for that today.. Jian also mentioned pg_add_s16_overflow(), which is a good idea for this case. :D -- Michael --Wy8dRiS/r7JiD+y4 Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmq2OSgACgkQnvQgOdby QH1o5RAAjJmK/mzfojDKzybmHd0q6fL8B8dtc48la+5V6mbBsi7giCLLjuHRH0wk lBYuzxfeHhZGlKl9NyA4znuPZzzQKgIHBCKkY8G9cJPspQj40sKTiS4Rw8IT34T+ UjDy+xF7TDpQGXV57gEugDKrdhjn3GYjvew3ayn5u6pPNgW2jm4HBKNoj26Lmu6Z Cl5/g9xhp3KfXUazV5B52r4RGGzJ7q2YmFdKhE5CVWG767qcmVP/aDnGxbUXxSdD ATyy+KmrskAVHGZpYq0nHq4VBI+L2N/vyyruEhIkisoGZeucxrFa6v9BiPc8vcIY yvbvnA+G+Gvr6njnHixN8AH/5j6KzHtc3wqBIoCq05nPTZPNyK1dkNcfimd0YIpo GPpFN170GBf88yHjtykbaQM9UOfevTwkTb5LEmxJM5EGM9h7cNLeQjnLs2pFxHAc PyGH55Qm85iiiDVzcvwen31/0LAZw8Snw/HcBbq6MnOGKzqPMGJX/I4w+6hbb+c8 s8s+GBuQ895JmDC7587XoudtMw3tUrnSPl6at9m1tTbpeCyNVB9cKcU84hcvHgcp 7Zh6k8/7hsiTPZmqx3t7GTbJG6u2+KAJWhYEpui0UynlJDHtahGmQuRQbs7KtNF3 XKAxrUUiRj8Derpk4zeZWsGVHkI6mQ4H+AXggIAtA7KY9Zp2JgE= =qYu3 -----END PGP SIGNATURE----- --Wy8dRiS/r7JiD+y4--