pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Peter Eisentraut <peter@eisentraut.org>
Cc: pgsql-bugs <pgsql-bugs@postgresql.org>
Subject: Re: CREATE CAST allows creation of binary-coercible cast to range over domain
Date: Tue, 20 Aug 2024 10:46:15 -0400
Message-ID: <1537781.1724165175@sss.pgh.pa.us> (raw)
In-Reply-To: <076968e1-0852-40a9-bc0b-117cd3f0e43c@eisentraut.org>
References: <076968e1-0852-40a9-bc0b-117cd3f0e43c@eisentraut.org>

Peter Eisentraut <peter@eisentraut.org> 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





view thread (6+ messages)  latest in thread

Message-ID: <1537781.1724165175@sss.pgh.pa.us>
Permalink:  ../1537781.1724165175@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1537781.1724165175@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, peter@eisentraut.org
  Subject: Re: CREATE CAST allows creation of binary-coercible cast to range over domain
  In-Reply-To: <1537781.1724165175@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox