Re: BUG #4362: Casts from base types to composite types don't work. - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #4362: Casts from base types to composite types don't work.
Date
Msg-id 20126.1218985660@sss.pgh.pa.us
Whole thread Raw
In response to BUG #4362: Casts from base types to composite types don't work.  ("Andrej Podzimek" <andrej@podzimek.org>)
List 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 by date:

Previous
From: "Andrej Podzimek"
Date:
Subject: BUG #4362: Casts from base types to composite types don't work.
Next
From: Alvaro Herrera
Date:
Subject: Re: BUG #4340: SECURITY: Is SSL Doing Anything?