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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Andrej Podzimek" <andrej(at)podzimek(dot)org>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #4362: Casts from base types to composite types don't work.
Date: 2008-08-17 15:07:40
Message-ID: 20126.1218985660@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Alvaro Herrera 2008-08-18 21:56:51 Re: BUG #4340: SECURITY: Is SSL Doing Anything?
Previous Message Hiroshi Saito 2008-08-17 02:44:55 Re: BUG #4361: ODBC Driver 08030200 Hangs Excel