Re: CAST ON NEW TYPE

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pejac(at)altern(dot)org
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: CAST ON NEW TYPE
Date: 2000-12-06 15:34:04
Message-ID: 6886.976116844@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

<pejac(at)altern(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Lockhart 2000-12-06 15:55:03 Re: CAST ON NEW TYPE
Previous Message pejac 2000-12-06 15:02:52 CAST ON NEW TYPE