Re: Hex Integer Input

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Achilleus Mantzios <achill(at)matrix(dot)gatewaynet(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Hex Integer Input
Date: 2003-03-07 17:13:14
Message-ID: 1000.1047057194@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Achilleus Mantzios <achill(at)matrix(dot)gatewaynet(dot)com> writes:
> Hi, is there a way to enter integer data by their HEX
> representation??

I'm not sure that this is SQL-spec, but at least as of 7.3, you can
coerce a bitstring literal to int, so:

z=# select x'0f';
?column?
----------
00001111
(1 row)

z=# select x'0f'::int4;
int4
------
15
(1 row)

Looks like it works for int8 as well.

regards, tom lane

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Mark Mitchell 2003-03-07 17:17:29 Re: Underscores in column names
Previous Message Tom Lane 2003-03-07 17:08:19 Re: Underscores in column names