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 1sgQ7v-001xfL-IF for pgsql-bugs@arkaria.postgresql.org; Tue, 20 Aug 2024 14:46:27 +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 1sgQ7s-000RMK-K8 for pgsql-bugs@arkaria.postgresql.org; Tue, 20 Aug 2024 14:46:25 +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 1sgQ7s-000RMC-Bm for pgsql-bugs@lists.postgresql.org; Tue, 20 Aug 2024 14:46:24 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sgQ7l-000cv8-EG for pgsql-bugs@postgresql.org; Tue, 20 Aug 2024 14:46:24 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 47KEkFCs1537782; Tue, 20 Aug 2024 10:46:15 -0400 From: Tom Lane To: Peter Eisentraut cc: pgsql-bugs Subject: Re: CREATE CAST allows creation of binary-coercible cast to range over domain In-reply-to: <076968e1-0852-40a9-bc0b-117cd3f0e43c@eisentraut.org> References: <076968e1-0852-40a9-bc0b-117cd3f0e43c@eisentraut.org> Comments: In-reply-to Peter Eisentraut message dated "Tue, 20 Aug 2024 11:00:21 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1537780.1724165175.1@sss.pgh.pa.us> Date: Tue, 20 Aug 2024 10:46:15 -0400 Message-ID: <1537781.1724165175@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Peter Eisentraut writes: > CREATE CAST disallows creating a binary-coercible cast to a domain > (because that would bypass checking the domain constraints). But it > allows it if the domain is wrapped inside a range type: > ... > This particular case seems straightforward to fix, but maybe there are > also cases with more nesting to consider. I think it's an oversight that we allow binary-coercible casts involving range types at all. There are no other nesting cases to worry about, because CreateCast already rejects binary-coercible casts applied to composites and arrays, explaining * We know that composite, enum and array types are never binary- * compatible with each other. They all have OIDs embedded in them. But range types also embed their own OID, so I don't see why that concern doesn't apply to them. regards, tom lane