CREATE CAST too strict?

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема CREATE CAST too strict?
Дата
Msg-id 200807091609.35876.peter_e@gmx.net
обсуждение исходный текст
Ответы Re: CREATE CAST too strict?  (Peter Eisentraut <peter_e@gmx.net>)
Список pgsql-hackers
I noticed that some of the entries in pg_cast are shaped in a way that CREATE 
CAST wouldn't let pass.  For example, the cast from cidr to varchar is 
effectively defined as

CREATE CAST (cidr AS varchar) WITH FUNCTION text(inet) AS ASSIGNMENT;

but CREATE CAST wouldn't allow this because the argument type of the function 
doesn't match the source type of the cast and the return type of the function 
doesn't match the target type.  (These are two separate tests.)

I propose that we relax these two checks to test for binary-coercibility 
instead, which is effectively what is expected and required here anyway.

The application is that I would like to create alias types for compatibility 
that have a different name but behave mostly like an existing type.  For that 
I would like to reuse a few of these cast functions.  Pretty much exactly how 
text vs. varchar is handled.  Citext might actually also benefit.


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

Предыдущее
От: Zdenek Kotala
Дата:
Сообщение: Re: [WIP] patch - Collation at database level
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Auto-explain patch