Re: writing own cast - Mailing list pgsql-general

From Moritz Sinn
Subject Re: writing own cast
Date
Msg-id m3fzxf56vt.fsf@moritz.sinnhq.de
Whole thread Raw
In response to Re: writing own cast  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: writing own cast  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Tom Lane <tgl@sss.pgh.pa.us> writes:

> Sure, make a function hex(int) returning hex.  The function name
> must match the datatype name.

thanks, now it works!
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.
well, that doesn't matter much, but it interests me if this problem
could be solved too. i think the reason is that the input function of my
hexadecimal datatype expects an string, and so the int is turned into an
string and then passed to this input function.

regards,
 moritz

--
Try to remove the color-problem by restarting your computer several times.
    -- Microsoft Internet Explorer README.TXT

pgsql-general by date:

Previous
From: Justin Clift
Date:
Subject: Finally, a list of *big* companies using PostgreSQL for *serious* projects. Why use PostgreSQL? Here's why.
Next
From: Sean Chittenden
Date:
Subject: Re: [HACKERS] Finally, a list of *big* companies using PostgreSQL for *serious* projects. Why use PostgreSQL? Here's why.