Re: CAST ON NEW TYPE - Mailing list pgsql-hackers

From Tom Lane
Subject Re: CAST ON NEW TYPE
Date
Msg-id 6886.976116844@sss.pgh.pa.us
Whole thread Raw
In response to CAST ON NEW TYPE  (<pejac@altern.org>)
List pgsql-hackers
<pejac@altern.org> writes:
> select bare_code::text from ean_article;
> ERROR:  Cannot cast type 'ean13' to 'text'

> What can i do in my new type in order to use cast ???

You have to provide a conversion function, declared like
text(ean13) returns text

The cast syntax is just an alias for invoking this function.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Camm Maguire
Date:
Subject: Re: Foreign key references to non-primary key columns
Next
From: Thomas Lockhart
Date:
Subject: Re: CAST ON NEW TYPE