From: Achilleus Mantzios <achill@matrix.gatewaynet.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-sql@postgresql.org
Subject: Re: Hex Integer Input
Date: Tue, 11 Mar 2003 10:14:30 -0200 (GMT+2)
Message-ID: <Pine.LNX.4.44.0303111014180.23176-100000@matrix.gatewaynet.com> (raw)
In-Reply-To: <1000.1047057194@sss.pgh.pa.us>
On Fri, 7 Mar 2003, Tom Lane wrote:
> Achilleus Mantzios <achill@matrix.gatewaynet.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)
Thanx.
>
> Looks like it works for int8 as well.
>
> regards, tom lane
>
--
==================================================================
Achilleus Mantzios
S/W Engineer
IT dept
Dynacom Tankers Mngmt
Nikis 4, Glyfada
Athens 16610
Greece
tel: +30-210-8981112
fax: +30-210-8981877
email: achill@matrix.gatewaynet.com
mantzios@softlab.ece.ntua.gr
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: achill@matrix.gatewaynet.com, tgl@sss.pgh.pa.us
Subject: Re: Hex Integer Input
In-Reply-To: <Pine.LNX.4.44.0303111014180.23176-100000@matrix.gatewaynet.com>
References: <1000.1047057194@sss.pgh.pa.us> <Pine.LNX.4.44.0303111014180.23176-100000@matrix.gatewaynet.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox