Re: hexadecimal values

From: Jeff Davis <list-pgsql-general(at)empires(dot)org>
To: Thierry Besancon <Thierry(dot)Besancon(at)paris4(dot)sorbonne(dot)fr>, pgsql-general(at)postgresql(dot)org
Subject: Re: hexadecimal values
Date: 2002-05-03 00:29:21
Message-ID: 200205030030.RAA19070@smtp.ucsd.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2002-05-03 00:42:20 Re: Fwd: Postfix Relay Hub SMTP server: errors from postgresql.org[64.49.215.8]
Previous Message Lev Lvovsky 2002-05-03 00:26:12 order of adding date & interval values?