Unix Technical Forum

hex integer input

This is a discussion on hex integer input within the pgsql Hackers forums, part of the PostgreSQL category; --> On several occasions I have wanted to input integers in hexadecimal rather than in decimal in PostgreSQL. I notice ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Hackers

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-12-2008, 07:30 AM
Jeremy Drake
 
Posts: n/a
Default hex integer input

On several occasions I have wanted to input integers in hexadecimal rather
than in decimal in PostgreSQL. I notice that there is a to_hex function,
but there is not (AFAIK) a way to provide an integer in hexadecimal.

I have written a pure-sql implementation of some functions to input
integers in hexadecimal
(http://postgresql.jdrake.com/hex-int-in.sql.html), but it is less than
efficient

Is there some reason why hex input is not currently supported? What would
be the preferred way to implement it?

1. A function (or one for each int[248]), essentially from_hex(text)

2. Support in the input functions for int[248] for integers that start
with '0[Xx]' as with strtol with base set to 0.

3. Support in the grammar for integral constants 0[Xx][0-9A-Fa-f]+

Thoughts? Is this a legitimate TODO?

--
Mr. Cole's Axiom:
The sum of the intelligence on the planet is a constant; the
population is growing.

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-12-2008, 07:30 AM
Tom Lane
 
Posts: n/a
Default Re: hex integer input

Jeremy Drake <pgsql@jdrake.com> writes:
> On several occasions I have wanted to input integers in hexadecimal rather
> than in decimal in PostgreSQL. I notice that there is a to_hex function,
> but there is not (AFAIK) a way to provide an integer in hexadecimal.


regression=# select x'abcd'::int;
int4
-------
43981
(1 row)


regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-12-2008, 07:30 AM
Jeremy Drake
 
Posts: n/a
Default Re: hex integer input

On Fri, 2 Mar 2007, Tom Lane wrote:

> Jeremy Drake <pgsql@jdrake.com> writes:
> > On several occasions I have wanted to input integers in hexadecimal rather
> > than in decimal in PostgreSQL. I notice that there is a to_hex function,
> > but there is not (AFAIK) a way to provide an integer in hexadecimal.

>
> regression=# select x'abcd'::int;
> int4
> -------
> 43981
> (1 row)


Hmm. I actually used the bit(N) type on a project quite some time ago,
but it did not occur to me to use the bit string input syntax to input an
integer.

Well, I guess there is a way after all. So in the immortal words of Emily
Litella, "Never mind."


--
In an organization, each person rises to the level of his own
incompetency
-- The Peter Principle

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-12-2008, 07:30 AM
Vishal Arora
 
Posts: n/a
Default xlogViewer / xlogdump


Hi

Does anyone has an idea how xlogdump works with Windows installation of
Postgres.
I have postgres 8.2.x installed on my windows PC.

How do we install it on Linux box with existing postgres 8.2.x installation

Thanks

Vishal

__________________________________________________ _______________
Find a local pizza place, movie theater, and more….then map the best route!
http://maps.live.com/?icid=hmtag1&FORM=MGAC01


---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-12-2008, 07:30 AM
Vishal Arora
 
Posts: n/a
Default Re: xlogViewer / xlogdump

I am getting a following error while make install for xlogdump -

[root@localhost xlogdump]# make install
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Winline
-Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing xlogdump.o
..../../src/port/sprompt.o ../../src/backend/utils/hash/pg_crc.o
-L../../src/port -lpgport -L../../src/interfaces/libpq -lpq -L../../src/port
-Wl,-rpath,'/usr/local/pgsql/lib' -lpgport -lz -lreadline -ltermcap
-lcrypt -ldl -lm -o xlogdumpxlogdump.o(.text+0x163f): In function
`dumpXLog':
: undefined reference to `__stack_chk_fail'
collect2: ld returned 1 exit status
make: *** [xlogdump] Error 1


Please anyone can help in the same


>From: "Vishal Arora" <aroravishal22@hotmail.com>
>To: pgsql-hackers@postgresql.org
>Subject: [HACKERS] xlogViewer / xlogdump
>Date: Fri, 02 Mar 2007 08:54:07 +0000
>
>
>Hi
>
>Does anyone has an idea how xlogdump works with Windows installation of
>Postgres.
>I have postgres 8.2.x installed on my windows PC.
>
>
>Thanks
>
>Vishal
>
>_________________________________________________ ________________
>Find a local pizza place, movie theater, and more….then map the best route!
>http://maps.live.com/?icid=hmtag1&FORM=MGAC01
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 5: don't forget to increase your free space map settings


__________________________________________________ _______________
With tax season right around the corner, make sure to follow these few
simple tips.
http://articles.moneycentral.msn.com...d=HMFebtagline


---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 04-12-2008, 07:30 AM
Jonah H. Harris
 
Posts: n/a
Default Re: xlogViewer / xlogdump

On 3/2/07, Vishal Arora <aroravishal22@hotmail.com> wrote:
> I am getting a following error while make install for xlogdump -


For some reason, Diogo kept his already-built code in there, so you
need to do a make clean && make install

--
Jonah H. Harris, Software Architect | phone: 732.331.1324
EnterpriseDB Corporation | fax: 732.331.1301
33 Wood Ave S, 3rd Floor | jharris@enterprisedb.com
Iselin, New Jersey 08830 | http://www.enterprisedb.com/

---------------------------(end of broadcast)---------------------------
TIP 7: You can help support the PostgreSQL project by donating at

http://www.postgresql.org/about/donate

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 05:12 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com