Re: BUG #2490: '||' and type casting for user defined types

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #2490: '||' and type casting for user defined types
Дата
Msg-id 1541.1150998092@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #2490: '||' and type casting for user defined types  ("Nikolay Samokhvalov" <pg-bugs@samokhvalov.com>)
Список pgsql-bugs
"Nikolay Samokhvalov" <pg-bugs@samokhvalov.com> writes:
> CREATE CAST (aaa AS text) WITHOUT FUNCTION
>     AS IMPLICIT;
> CREATE CAST (text AS aaa) WITHOUT FUNCTION
>     AS IMPLICIT;

> trash=# select ('as' || 'df')::aaa;
>  aaa
> ------
>  asdf
> (1 row)

> In the last case, function aaa_in() wasn't invoked at all and we obtained
> the sting of type aaa with length > 3...

Well, sure.  You declared the text to aaa cast as WITHOUT FUNCTION; that
says the system can relabel any legal text value as an aaa.  If you want
to enforce a length limit on the cast result, you need to write a cast
function that does it.

            regards, tom lane

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

Предыдущее
От: Klaus Ita
Дата:
Сообщение: Re: Error on createuser
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #2488: backup history file is archived doubly