pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Achilleus Mantzios <achill@matrix.gatewaynet.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Hex Integer Input
Date: Fri, 07 Mar 2003 12:13:14 -0500
Message-ID: <1000.1047057194@sss.pgh.pa.us> (raw)
In-Reply-To: <Pine.LNX.4.44.0303071813220.22898-100000@matrix.gatewaynet.com>
References: <Pine.LNX.4.44.0303071813220.22898-100000@matrix.gatewaynet.com>

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)

Looks like it works for int8 as well.

			regards, tom lane



view thread (5+ messages)  latest in thread

Message-ID: <1000.1047057194@sss.pgh.pa.us>
Permalink:  ../1000.1047057194@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1000.1047057194@sss.pgh.pa.us

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, achill@matrix.gatewaynet.com
  Subject: Re: Hex Integer Input
  In-Reply-To: <1000.1047057194@sss.pgh.pa.us>

* 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