Re: writing own cast

From: Moritz Sinn <moritz(at)freesources(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: writing own cast
Date: 2002-08-16 12:24:06
Message-ID: m3fzxf56vt.fsf@moritz.sinnhq.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruno Wolff III 2002-08-16 12:48:31 Re: serial nextval() question
Previous Message Christian Mock 2002-08-16 10:48:41 Re: performance with triggers depends on table size?