Re: hexadecimal values - Mailing list pgsql-general

From Jeff Davis
Subject Re: hexadecimal values
Date
Msg-id 200205030030.RAA19070@smtp.ucsd.edu
Whole thread Raw
In response to hexadecimal values  (Thierry Besancon <Thierry.Besancon@paris4.sorbonne.fr>)
List pgsql-general
Oh, that makes more sense. I don't think that there is an internal postgres
stored procedure for doing that, but I can't imagine it would be that hard to
write one.

I suppose that someone could add the ability to parse hex values in the text
to int converter. Is that what you'd like to see? that way you could do:

select '0x10'::int;
or:
select '10'::int;

and they would return 16 and 10 respectively.

It also should be quite easy to do the conversion in your application before
sending it to the database. Look at the C function strtol().

Regards,
    Jeff

On Thursday 02 May 2002 03:06 pm, Thierry Besancon wrote:
> >> What do you mean you won't know in advance? If not, how do you tell the
> >> difference between 10 hexadecimal (which is 16) and 10 decimal (which is
> >> 10) ?
>
> I mean the user can input 0x10 or 010 or 10 and I want the C way of dealing
> with these numbers.
>
>     Thierry

pgsql-general by date:

Previous
From: Lev Lvovsky
Date:
Subject: order of adding date & interval values?
Next
From: Tom Lane
Date:
Subject: Re: Fwd: Postfix Relay Hub SMTP server: errors from postgresql.org[64.49.215.8]