Re: BUG #4362: Casts from base types to composite types don't work.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #4362: Casts from base types to composite types don't work.
Дата
Msg-id 20126.1218985660@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #4362: Casts from base types to composite types don't work.  ("Andrej Podzimek" <andrej@podzimek.org>)
Список pgsql-bugs
"Andrej Podzimek" <andrej@podzimek.org> writes:
> select cast (text 'blabla' as pxgt_xid);
> ERROR:  malformed record literal: "blabla"
> DETAIL:  Missing left parenthesis.

Works for me, after fixing the obvious typo in your CREATE CAST command:

regression=# CREATE TYPE pxgt_xid AS (xid bigint, xname text);
CREATE TYPE
regression=# CREATE FUNCTION pxgt_xid(text) RETURNS pxgt_xid AS
$BODY$ select cast ( null as bigint ), $1; $BODY$
LANGUAGE 'sql' IMMUTABLE;
CREATE FUNCTION
regression=# CREATE CAST (text AS pxgt_xid) WITH FUNCTION pxgt_xid(text) AS IMPLICIT;
CREATE CAST
regression=# select cast (text 'blabla' as pxgt_xid);
 pxgt_xid
-----------
 (,blabla)
(1 row)


            regards, tom lane

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