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

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема CREATE CAST allows creation of binary-coercible cast to range over domain
Дата
Msg-id 076968e1-0852-40a9-bc0b-117cd3f0e43c@eisentraut.org
обсуждение исходный текст
Ответы Re: CREATE CAST allows creation of binary-coercible cast to range over domain
Список pgsql-bugs
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:

CREATE DOMAIN mydomain AS int4 CHECK (VALUE > 0);
CREATE CAST (int4 AS mydomain) WITHOUT FUNCTION;  -- error (ok)

CREATE TYPE mydomainrange AS range (subtype=mydomain);
CREATE CAST (int4range AS mydomainrange) WITHOUT FUNCTION;  -- FIXME

SELECT int4range(-5,-4)::mydomainrange;  -- this succeeds

This particular case seems straightforward to fix, but maybe there are 
also cases with more nesting to consider.

(I just found this while exploring other range-over-domain issues in 
some in-progress work.)



В списке pgsql-bugs по дате отправления: