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 1tVVpm-0097k0-1v for pgsql-general@arkaria.postgresql.org; Wed, 08 Jan 2025 13:10:54 +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 1tVVpk-000qff-US for pgsql-general@arkaria.postgresql.org; Wed, 08 Jan 2025 13:10:52 +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 1tVVpk-000qep-6Q for pgsql-general@lists.postgresql.org; Wed, 08 Jan 2025 13:10:52 +0000 Received: from fhigh-a8-smtp.messagingengine.com ([103.168.172.159]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tVVph-000WIz-2G for pgsql-general@lists.postgresql.org; Wed, 08 Jan 2025 13:10:50 +0000 Received: from phl-compute-01.internal (phl-compute-01.phl.internal [10.202.2.41]) by mailfhigh.phl.internal (Postfix) with ESMTP id 9645411401B4; Wed, 8 Jan 2025 08:10:48 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-01.internal (MEProxy); Wed, 08 Jan 2025 08:10:48 -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=1736341848; x=1736428248; bh=b NsIjiMTiY/Gcf6lb75MhZlAaFEIkmkWnf2F4/J8x5Q=; b=U5NrdPPvdDBZol48m LDR7fNbxnEWuj3kZL6faYTau7dCpfEeL1Udum7LCHmnbwiZD6f2iRmmsrEaZab5o m9k0PtQoQI54aj7QYsMK8TWPMhx2ztdLtvKMgCr6mzBvrZ9R9nJTAVZWxtH8sxyH M1xeLPXwUQQUZlAsOXgj9/AQHX0Gii1+yIpFqXsIoJeTfTN6rnCIEU6NVuAOIVna ScbPivzrVAA78x91/p6NYdLV5LFvis4zmMS7wo+MY5xl3ZnjcPpLhQJGd+12/ISt fc9NTmRFeCM1/2G/rHoDHlMxcZMHfoenBkdewauBOOGQj1MaANTuNUyf8ATkY8JY t0D/w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudeggedggeelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpeffhffvve fukfggtggugfgjsehtkeertddttdejnecuhfhrohhmpeetlhhvrghrohcujfgvrhhrvghr rgcuoegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhgqeenucggtffrrghtth gvrhhnpeeuiefgffeukedtgfetueeugfetvdeuhefgheelfeehleejleefffejtddtkedv jeenucffohhmrghinhepphhoshhtghhrrdgvshdpvghnthgvrhhprhhishgvuggsrdgtoh hmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghl vhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrghdpnhgspghrtghpthhtohepvddpmh houggvpehsmhhtphhouhhtpdhrtghpthhtohepshhhrghmmhgrthesghhmgidrnhgvthdp rhgtphhtthhopehpghhsqhhlqdhgvghnvghrrghlsehlihhsthhsrdhpohhsthhgrhgvsh hqlhdrohhrgh X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 8 Jan 2025 08:10:48 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alvh.no-ip.org; s=schmee; t=1736341845; bh=QhDQkRfkVEQgFLehfbSwsHtSmzBr1BVOsp9mGpxc9Dk=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=IQGHtxDuCvWh6DODV1Ui0L2nyizUxdsukNsPNNtrNbJzr/mVrSeTWlkp0EN78CUIc fwxCgeSWKy3aCZoBtHn0ODT0N9JDRv9/Ye7XOzIen3yIjYzetXqQNNoVlnyiQhMq4S Suoqo7yc/BawmkA2QKI5gWb90UqbgzZ5B26Qk6LMe3+HBUNpbqiXf/4ZGvV9fX7935 fXRrMYVVY9XdH7ayqqr1ZdW4FefKoIxzhVw+QQ2PxuLrr3XbGJku5JNep6tKNpRvGY vNKqih6ApgDnFxDuu8SJYnm1qV3ak8U8PhpUanoUGXxIAV9vvd7lPP5HHCpbgOK3VE Yvo7iBurv7+UQ== Received: by schmee.alvh.no-ip.org (Postfix, from userid 1000) id CBBD6307; Wed, 8 Jan 2025 14:10:45 +0100 (CET) Date: Wed, 8 Jan 2025 14:10:45 +0100 From: Alvaro Herrera To: shammat@gmx.net Cc: pgsql-general@lists.postgresql.org Subject: Re: Postgres 17 domains with NOT NULL and pg_get_constraintdef() Message-ID: <202501081310.k4vpnx4wa623@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 2025-Jan-08, shammat@gmx.net wrote: Hello, > However, because the domain is defined with NOT NULL, this fails with > > > ERROR: invalid constraint type "n" > > with 17.2 on Windows and Linux. > > This is a result of storing the NOT NULL constraint in pg_constraint > and can easily be avoided by either using contype <> 'n' or by not calling > pg_get_constraintdef if contype = 'n' Yeah, thanks for the report -- this is clearly a bug and it was fixed already in the 17 branch, but it's not been released yet. It'll be in the February release. Author: Álvaro Herrera Branch: master [09d09d429] 2024-11-27 13:50:27 +0100 Branch: REL_17_STABLE [6e793582b] 2024-11-27 13:50:27 +0100 Fix pg_get_constraintdef for NOT NULL constraints on domains We added pg_constraint rows for all not-null constraints, first for tables and later for domains; but while the ones for tables were reverted, the ones for domains were not. However, we did accidentally revert ruleutils.c support for the ones on domains in 6f8bb7c1e961, which breaks running pg_get_constraintdef() on them. Put that back. This is only needed in branch 17, because we've reinstated this code in branch master with commit 14e87ffa5c54. Add some new tests in both branches. I couldn't find anything else that needs de-reverting. Reported-by: Erki Eessaar Reviewed-by: Magnus Hagander Discussion: https://postgr.es/m/AS8PR01MB75110350415AAB8BBABBA1ECFE222@AS8PR01MB7511.eurprd01.prod.exchangelabs.com -- Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/ "Right now the sectors on the hard disk run clockwise, but I heard a rumor that you can squeeze 0.2% more throughput by running them counterclockwise. It's worth the effort. Recommended." (Gerry Pourwelle)