Sunday, August 17, 2008

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

"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

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

No comments: