Re: CREATE CAST allows creation of binary-coercible cast to range over domain

Richard Guo <guofenglinux@gmail.com>

From: Richard Guo <guofenglinux@gmail.com>
To: Peter Eisentraut <peter@eisentraut.org>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, pgsql-bugs <pgsql-bugs@postgresql.org>
Date: 2024-08-21T07:55:30Z
Lists: pgsql-bugs
On Wed, Aug 21, 2024 at 2:14 PM Peter Eisentraut <peter@eisentraut.org> wrote:
> On 20.08.24 19:30, Tom Lane wrote:
> > In short, more or less as attached.  (I didn't bother with a
> > regression test, since none of the adjacent error checks are
> > covered either.)
>
> This patch looks right.

This patch also looks good to me.  To nitpick:

-    * We know that composite, enum and array types are never binary-
-    * compatible with each other.  They all have OIDs embedded in them.
+    * We know that composite, array, range and enum types are never
+    * binary-compatible with each other.  They all have OIDs embedded in
+    * them.

I wonder if it would be better for readability to list these types in
the order we check them in the code, as we did previously, i.e.:

    * We know that composite, range, enum and array types are never
    * ...

Thanks
Richard



Commits

  1. Disallow creating binary-coercible casts involving range types.