pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedRe: Hex Integer Input
5+ messages / 3 participants
[nested] [flat]
* Hex Integer Input
@ 2003-03-07 20:14 Achilleus Mantzios <achill@matrix.gatewaynet.com>
2003-03-07 16:50 ` Re: Hex Integer Input Joe Conway <mail@joeconway.com>
2003-03-07 17:13 ` Re: Hex Integer Input Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 2 replies; 5+ messages in thread
From: Achilleus Mantzios @ 2003-03-07 20:14 UTC (permalink / raw)
To: pgsql-sql
Hi, is there a way to enter integer data by their HEX
representation??
--
==================================================================
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
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Hex Integer Input
2003-03-07 20:14 Hex Integer Input Achilleus Mantzios <achill@matrix.gatewaynet.com>
@ 2003-03-07 16:50 ` Joe Conway <mail@joeconway.com>
2003-03-11 12:13 ` Re: Hex Integer Input Achilleus Mantzios <achill@matrix.gatewaynet.com>
1 sibling, 1 reply; 5+ messages in thread
From: Joe Conway @ 2003-03-07 16:50 UTC (permalink / raw)
To: Achilleus Mantzios <achill@matrix.gatewaynet.com>; +Cc: pgsql-sql
Achilleus Mantzios wrote:
> Hi, is there a way to enter integer data by their HEX
> representation??
>
Is this what you want?
regression=# select x'ffff'::int4;
int4
-------
65535
(1 row)
Joe
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Hex Integer Input
2003-03-07 20:14 Hex Integer Input Achilleus Mantzios <achill@matrix.gatewaynet.com>
2003-03-07 16:50 ` Re: Hex Integer Input Joe Conway <mail@joeconway.com>
@ 2003-03-11 12:13 ` Achilleus Mantzios <achill@matrix.gatewaynet.com>
0 siblings, 0 replies; 5+ messages in thread
From: Achilleus Mantzios @ 2003-03-11 12:13 UTC (permalink / raw)
To: Joe Conway <mail@joeconway.com>; +Cc: pgsql-sql
On Fri, 7 Mar 2003, Joe Conway wrote:
> Achilleus Mantzios wrote:
> > Hi, is there a way to enter integer data by their HEX
> > representation??
> >
>
> Is this what you want?
>
> regression=# select x'ffff'::int4;
> int4
> -------
> 65535
> (1 row)
Sure. Thanx.
>
>
> Joe
>
--
==================================================================
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
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Hex Integer Input
2003-03-07 20:14 Hex Integer Input Achilleus Mantzios <achill@matrix.gatewaynet.com>
@ 2003-03-07 17:13 ` Tom Lane <tgl@sss.pgh.pa.us>
2003-03-11 12:14 ` Re: Hex Integer Input Achilleus Mantzios <achill@matrix.gatewaynet.com>
1 sibling, 1 reply; 5+ messages in thread
From: Tom Lane @ 2003-03-07 17:13 UTC (permalink / raw)
To: Achilleus Mantzios <achill@matrix.gatewaynet.com>; +Cc: pgsql-sql
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
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Hex Integer Input
2003-03-07 20:14 Hex Integer Input Achilleus Mantzios <achill@matrix.gatewaynet.com>
2003-03-07 17:13 ` Re: Hex Integer Input Tom Lane <tgl@sss.pgh.pa.us>
@ 2003-03-11 12:14 ` Achilleus Mantzios <achill@matrix.gatewaynet.com>
0 siblings, 0 replies; 5+ messages in thread
From: Achilleus Mantzios @ 2003-03-11 12:14 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-sql
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
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2003-03-11 12:14 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-03-07 20:14 Hex Integer Input Achilleus Mantzios <achill@matrix.gatewaynet.com>
2003-03-07 16:50 ` Joe Conway <mail@joeconway.com>
2003-03-11 12:13 ` Achilleus Mantzios <achill@matrix.gatewaynet.com>
2003-03-07 17:13 ` Tom Lane <tgl@sss.pgh.pa.us>
2003-03-11 12:14 ` Achilleus Mantzios <achill@matrix.gatewaynet.com>
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