Re: writing own cast - Mailing list pgsql-general

From Tom Lane
Subject Re: writing own cast
Date
Msg-id 7232.1029506218@sss.pgh.pa.us
Whole thread Raw
In response to Re: writing own cast  (Moritz Sinn <moritz@freesources.org>)
List pgsql-general
Moritz Sinn <moritz@freesources.org> writes:
> but i've to type 255::int::hex, because when i type 255::hex it first
> casts the int to an string and then to hex, so it returns 255 instead of
> ff.

I think this means that you need to rethink your I/O definitions for the
datatype.  255::hex is not really different from '255'::hex, and should
not be because the type of the literal constant is as yet unassigned.
The operation invoked is your type's input routine, and nothing else.
An operation like integercolumn::hex is a completely different thing.

            regards, tom lane

pgsql-general by date:

Previous
From: Elielson Fontanezi
Date:
Subject: DAO for PostGRE
Next
From: Oliver Elphick
Date:
Subject: Re: Triggers