writing own cast - Mailing list pgsql-general

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

i wrote my own hexadecimal datatype for postgresql. the input function
expects a char* and stores the data as an integer.
so i can do something like "SELECT 'ff'::hex;" to turn a string into my
datatype.
but i would like do be able doing the same with integers:
SELECT 255::hex;
... and then getting 'ff'.

do you know how i can realize that?
i already wrote a function 'to_hex' (int->hex) and 'to_int' (hex->int).

thanks,
 moritz

--


pgsql-general by date:

Previous
From: Larry Rosenman
Date:
Subject: Re: logs of postgresql and pid-stamping. possible
Next
From: Diogo Biazus
Date:
Subject: Seq scan