hex input values

From: "elein" <elein(at)nextbus(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Cc: <elein(at)nextbus(dot)com>
Subject: hex input values
Date: 2001-01-08 21:34:30
Message-ID: MABBJCMLMNABIPABODDHAEFECFAA.elein@nextbus.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


I cannot seem to insert hex values into an int column.
I must be doing something really stupid wrong, but I
can't see it.

insert into mytable (intcolumn) values (0xaabbcc);
parser error at "xaabbcc"
insert into mytable (intcolumn) values ('0xaabbcc');
pg_atoi...can't part "xaabbcc"
insert into mytable (intcolumn) values ('\0xaabbcc');
Inserts 0 (i.e. error/null value)
insert into mytable (intcolumn) values ('\\0xaabbcc');
pg_atoi...can't parse "\oaabbcc"

The pg_atoi() code calls strtol() which is documented
to handle hex values.

The error checking for EOS in pg_atoi() seems to be having
trouble with the leading zero.

Should I be storing these value as some other type?

thanks,

elein(at)nextbus(dot)com

Browse pgsql-general by date

  From Date Subject
Next Message Adam Haberlach 2001-01-08 21:57:58 Dangling large objects
Previous Message Mihail Marinov 2001-01-08 21:21:56 Re[2]: cyrillic and sort order (ORDER BY)