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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Adam Mackler <pgsql-general(at)mackler(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Re: User-defined operator function: what parameter type to use for uncast character string?
Date: 2014-08-01 15:45:18
Message-ID: 1536.1406907918@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Adam Mackler <pgsql-general(at)mackler(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Vik Fearing 2014-08-01 16:28:57 Re: Feature proposal and discussion: full-fledged column/function equivalence
Previous Message Larry White 2014-08-01 15:44:18 jsonb creation functions?