dbTalk Databases Forums  

no unsigned data types in ingres sql

comp.databases.ingres comp.databases.ingres


Discuss no unsigned data types in ingres sql in the comp.databases.ingres forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
morgan brickley
 
Posts: n/a

Default no unsigned data types in ingres sql - 09-08-2005 , 11:30 AM






I've noticed that there's no unsigned data types in ingres sql. This is
a problem for us as we need to allow access to a table usign unsigned
64-bit integers generated from afar (an authentication agent)...The
current solution is to base64 encode the 8byte values, producing 11byte
varchars that can at least be stored, compared etc. safely. The further
I go with this solution however the less I like it as I need to do quite
a bit of base64 encoding and decoding in python, where previouslt I
could do inserts etc with no fear of overflowing...

ie. I'm using the python dbi driver to execute strings containing CRUD
operations like

INSERT into table (id) values (someNumberGreaterThan2TothePowerOf63)

will produce an error as someNumberGreaterThan2TothePowerOf63 is in
string form and will be out of range.

As this is the index to the table, I can't use the binary types.

Any ideas?

Morgan

Reply With Quote
  #2  
Old   
Karl & Betty Schendel
 
Posts: n/a

Default Re: [Info-ingres] no unsigned data types in ingres sql - 09-08-2005 , 12:19 PM






At 5:30 PM +0100 9/8/2005, morgan brickley wrote:
Quote:
I've noticed that there's no unsigned data types in ingres sql. This is a problem for us as we need to allow access to a table usign unsigned 64-bit integers generated from afar (an authentication agent)...The current solution is to base64 encode the 8byte values, producing 11byte varchars that can at least be stored, compared etc. safely. The further I go with this solution however the less I like it as I need to do quite a bit of base64 encoding and decoding in python, where previouslt I could do inserts etc with no fear of overflowing...

ie. I'm using the python dbi driver to execute strings containing CRUD operations like

INSERT into table (id) values (someNumberGreaterThan2TothePowerOf63)

will produce an error as someNumberGreaterThan2TothePowerOf63 is in string form and will be out of range.
The SQL Standard doesn't allow for unsigned numeric types.

You can however take your unsigned number and send it to Ingres as if it
were signed. E.g. 2703443303 (0xa1234567) can be sent as -1591523993.
It's the same bit-pattern, just ascii-ized differently.

Karl


Reply With Quote
  #3  
Old   
Emiliano
 
Posts: n/a

Default Re: no unsigned data types in ingres sql - 09-08-2005 , 02:37 PM



morgan brickley wrote:
Quote:
I've noticed that there's no unsigned data types in ingres sql. This is
a problem for us as we need to allow access to a table usign unsigned
64-bit integers generated from afar (an authentication agent)...The
current solution is to base64 encode the 8byte values, producing 11byte
varchars that can at least be stored, compared etc. safely. The further
I go with this solution however the less I like it as I need to do quite
a bit of base64 encoding and decoding in python, where previouslt I
could do inserts etc with no fear of overflowing...

ie. I'm using the python dbi driver to execute strings containing CRUD
operations like

INSERT into table (id) values (someNumberGreaterThan2TothePowerOf63)

will produce an error as someNumberGreaterThan2TothePowerOf63 is in
string form and will be out of range.

As this is the index to the table, I can't use the binary types.

Any ideas?
Wouldn't a DECIMAL(19,0) suffice?

Emiliano


Reply With Quote
  #4  
Old   
Roy Hann
 
Posts: n/a

Default Re: [Info-ingres] no unsigned data types in ingres sql - 09-11-2005 , 09:20 AM




"Karl & Betty Schendel" <schendel (AT) kbcomputer (DOT) com> wrote

Quote:
At 5:30 PM +0100 9/8/2005, morgan brickley wrote:
I've noticed that there's no unsigned data types in ingres sql. This is
a problem for us as we need to allow access to a table usign unsigned 64-bit
integers generated from afar (an authentication agent)...The current
solution is to base64 encode the 8byte values, producing 11byte varchars
that can at least be stored, compared etc. safely. The further I go with
this solution however the less I like it as I need to do quite a bit of
base64 encoding and decoding in python, where previouslt I could do inserts
etc with no fear of overflowing...
Quote:
ie. I'm using the python dbi driver to execute strings containing CRUD
operations like

INSERT into table (id) values (someNumberGreaterThan2TothePowerOf63)

will produce an error as someNumberGreaterThan2TothePowerOf63 is in
string form and will be out of range.

The SQL Standard doesn't allow for unsigned numeric types.

You can however take your unsigned number and send it to Ingres as if it
were signed. E.g. 2703443303 (0xa1234567) can be sent as -1591523993.
It's the same bit-pattern, just ascii-ized differently.
I'd be uncomfortable using a signed type for an unsigned value because it
admits meaningless operations on the data, and worse still, apparently
meaningful operations that are wrong. How about using BYTE(4) or BYTE(8)?
In fact I would guess these types are *exactly* what is needed, since the
value being stored is probably not from a domain in which integer arithmetic
is even defined.

Roy Hann (rhann at rationalcommerce dot com)
Rational Commerce Ltd.
www.rationalcommerce.com
"Ingres development, tuning, and training experts"




Reply With Quote
  #5  
Old   
morgan brickley
 
Posts: n/a

Default Re: [Info-ingres] no unsigned data types in ingres sql - 09-12-2005 , 08:41 AM



Roy Hann wrote:
Quote:
"Karl & Betty Schendel" <schendel (AT) kbcomputer (DOT) com> wrote in message
news:mailman.1126200001.15354.info-ingres (AT) cariboulake (DOT) com...

At 5:30 PM +0100 9/8/2005, morgan brickley wrote:

I've noticed that there's no unsigned data types in ingres sql. This is

a problem for us as we need to allow access to a table usign unsigned 64-bit
integers generated from afar (an authentication agent)...The current
solution is to base64 encode the 8byte values, producing 11byte varchars
that can at least be stored, compared etc. safely. The further I go with
this solution however the less I like it as I need to do quite a bit of
base64 encoding and decoding in python, where previouslt I could do inserts
etc with no fear of overflowing...

ie. I'm using the python dbi driver to execute strings containing CRUD

operations like

INSERT into table (id) values (someNumberGreaterThan2TothePowerOf63)

will produce an error as someNumberGreaterThan2TothePowerOf63 is in

string form and will be out of range.

The SQL Standard doesn't allow for unsigned numeric types.

You can however take your unsigned number and send it to Ingres as if it
were signed. E.g. 2703443303 (0xa1234567) can be sent as -1591523993.
It's the same bit-pattern, just ascii-ized differently.


I'd be uncomfortable using a signed type for an unsigned value because it
admits meaningless operations on the data, and worse still, apparently
meaningful operations that are wrong. How about using BYTE(4) or BYTE(8)?
In fact I would guess these types are *exactly* what is needed, since the
value being stored is probably not from a domain in which integer arithmetic
is even defined.

Roy Hann (rhann at rationalcommerce dot com)
Rational Commerce Ltd.
www.rationalcommerce.com
"Ingres development, tuning, and training experts"

Indeed BYTE(8) does fit the bill,

Thanks Roy...


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



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.