Re: Re: User-defined operator function: what parameter type to use for uncast character string? - Mailing list pgsql-general

From Tom Lane
Subject Re: Re: User-defined operator function: what parameter type to use for uncast character string?
Date
Msg-id 1536.1406907918@sss.pgh.pa.us
Whole thread Raw
In response to Re: Re: User-defined operator function: what parameter type to use for uncast character string?  (Adam Mackler <pgsql-general@mackler.org>)
List pgsql-general
Adam Mackler <pgsql-general@mackler.org> writes:
> One final question: the 'CREATE CAST' command got my interest.  I'm
> assuming that when the docs say it 'performs a conversion between two
> data types,' that the meaning of "data type" includes only those
> created using 'CREATE TYPE' and excludes domains.  If I am mistaken on
> that point I would be grateful to learn of that mistake.

I wouldn't recommend it.  The expected behavior of up-casting to a domain
from its base type is that the value doesn't change but the domain's
current check constraints are applied.  I think that if you defined
a cast via CREATE CAST it would override that behavior (I've not verified
this though), and it would then be entirely on your head whether the
resulting value was actually a legal member of the domain.

            regards, tom lane


pgsql-general by date:

Previous
From: Larry White
Date:
Subject: jsonb creation functions?
Next
From: Vik Fearing
Date:
Subject: Re: Feature proposal and discussion: full-fledged column/function equivalence