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 1tVU21-008qtU-0D for pgsql-general@arkaria.postgresql.org; Wed, 08 Jan 2025 11:15:25 +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 1tVU20-00HCBV-Gv for pgsql-general@arkaria.postgresql.org; Wed, 08 Jan 2025 11:15:24 +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.94.2) (envelope-from ) id 1tVU20-00HCBJ-3b for pgsql-general@lists.postgresql.org; Wed, 08 Jan 2025 11:15:23 +0000 Received: from mout.gmx.net ([212.227.15.18]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tVU1w-000WEo-1t for pgsql-general@lists.postgresql.org; Wed, 08 Jan 2025 11:15:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1736334920; x=1736939720; i=shammat@gmx.net; bh=r/UIGAJbdYAoGNbA0i5JgrqNmZLySAd4KrrDzRgwr+Y=; h=X-UI-Sender-Class:Message-ID:Date:MIME-Version:To:From:Subject: Content-Type:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=beB2Y53WfVMGk73iWsKP95aAB6kLMWAvsAMQmy2tr8hshKEE4mStzSCRJ6V0Tkrf w4ZcVZiWTeuPZkQ9h8abdH+NDHSHcD3V89MTdfoX4ON6Q50+j3biY+XInAIcTjlgJ 24pj3qTeas+Sz+26h2/gctRsnfSoxRfgMzEpm4oTlDuB7/elXkAeIbqKpipS/ab9X gX+TCtRLeCXmG3Cg9ccwRwYN18BA6Z/SqZw4yJXM6sufBT0IB7g68ofMHfbT5WCWg GqUr+s19muMoRSt/fsp/rrtDH/isNFVdbwm1y89bcQlRkwLUkfwPtn4s/utF6lJHQ +KNQYfcRqrotsRqnEA== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [10.8.0.17] ([185.40.248.10]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MuUnA-1tmbD00uOI-014CKt for ; Wed, 08 Jan 2025 12:15:20 +0100 Message-ID: Date: Wed, 8 Jan 2025 12:15:19 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: de-DE, en-US To: pgsql-general@lists.postgresql.org From: shammat@gmx.net Subject: Postgres 17 domains with NOT NULL and pg_get_constraintdef() Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:kcu7hNhT0ksuSeqtClkXX2WnI6RoBkz/bKirqMhVnV9UFQ45s8/ IVqk2vCOfJiqVl5Cickd0BfVBGKShb9lqFewtyFSE3N3MUd95NFFVS2QmvwGV1H8uw5eEwv GXDz2fiKqoFC+/z9u8IzPpx9Pi8i4nHAhxFJGA6BAmFLYYvuJ1e87oC77n93IfEozCb17R5 cK6McCXEX4DUw3IhXfvcw== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:Js72o2vpTbk=;BgQmIWIMEkTnPAEdeNH44LTr4of c0GniMCzRyqKZVtOKwVzHjYJJuugMxbsVSEJbo4FuEmCWGj1IB5DfBORrA1I0LNCccveSBYH5 6RTchTL2k/uPnXiOP8JWauT6cq0jHti3ixievn6COhlTfLSe6eSy4xO6P0JPrkgHMYKuPUdJX JP+jo+gv8+kdesglcMSJQL9Ip2vcEuFkGBsuph5YHn9Z6ZpTcRrmabFRFGOagbmCtnmgi3Ryq 1auP8P1P2TSXMIzJLIIpDSfLj5TV8FUjybEbgCFfDjLAMIukqUyKcJ7/A5Gp7rG8EIQT3190z 0YjnR3mdgQeLr5w8FVOHOX1vpIX0FJ4Gk85sTtZsdq7fQ5DHXOXFEWTmG6J6CFVEXrnaJamvN DouqTs9N2lpRhe73JNE1E5uvYUPDqVMlESLc8vjjnsLCC/PKeKIR/287sUr17Uc5w5mJYqAgB toy/LXLHY/AWKZTC8G3CjKdWVgaCW9E3Er+To03DEI8kvrwE8Wb1+jhjqh1lc6EqX/DvkMqIr 9DcBs/H3jxZFagfQWFXKHAJe3Z6Z6gRXkQEydYArfUQbgNKPiMe0+zYGobWw45AkHxm+WV7au Wz7/D3dnXP8nN3q/eWpAEi+Teph63mQNSU+ISAg6ZwgLotMPUuSLM4eYmHO03Hh8bmqUPb85o k8XROhyulF6Y7lVcFE1moqPjBdGva/8gcojcZMeSw67NdTVW32HwDiuPZFeJUraqKvuB+/DaZ qWfe5vYVj70KcHdczY0sQfM9CJ8XB1p0uNQC38ivOWC3nXFwofpuLZ2Gg4o6ncVcdFaveRlWE hcY6hSWHlRsVi2IRz9nIcYeLyoPdNIzTu2n2KpCHWds6QakGmpwgIM8/Q4eGMX0Tqu68uexcW ybrIe3ZCkDOMFUM/q0vVyR5VRqXoAs2N9p1ZttM5Oq4CtBv5JQN5ym+7lZELLtxzFMO3igafF w0Qq6lAfgQC+Kqno14RjJ6mUUgUDOAkrcatLZMtmhxlKUskFGd5y6eT4Z/Q006qLeSomY9TgX yGnR7XnvOpxXnMo2v27Cpfn3zQHZm84O4yvuv/k1p3ijyqmRUoHUv6b2qjKiZ+jGZqyCvzRgA LSxw4Too0vhGVNn+QgeQDirJL9y5za List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hello, I am not sure if this is intended behavior or an oversight/bug. Assume the following domain definition: CREATE DOMAIN sample_domain AS numeric(12,2) NOT NULL constraint posit= ive_value CHECK (value > 0); Up until Postgres 16 it was possible to retrieve the domain constraints us= ing: select t.typname, pg_catalog.pg_get_constraintdef(ci.oid, true) from pg_catalog.pg_type t join pg_catalog.pg_constraint ci on ci.contypid =3D t.oid where t.typtype =3D 'd' and t.typname =3D 'sample_domain' 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 =3D 'n' Is this a bug/oversight in pg_get_constraintdef() or does it just not supp= ort NOT NULL constraints? The manual does not show any restriction on the usage.