"Andrej Podzimek" <andrej(at)podzimek(dot)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