MySQL Returns wrong values on SELECT statement
Posted
by Andrew K
on Stack Overflow
See other posts from Stack Overflow
or by Andrew K
Published on 2010-06-07T23:17:17Z
Indexed on
2010/06/07
23:22 UTC
Read the original article
Hit count: 187
mysql
All,
I'm wondering if this is a MySQL bug, but since I've seen others playing with larger numbers than this, I'm thinking I'm doing something wrong here.
Here is my table structure for the table I'm querying:
mysql> describe ipspace6\G
************* 1. row *************
Field: id
Type: decimal(39,0) unsigned
Null: NO
Key:
Default: NULL
Extra:
************* 2. row *************
Field: addr
Type: decimal(39,0) unsigned
Null: NO
Key: PRI
Default: 0
Extra:
************* 3. row *************
Field: netmask
Type: decimal(39,0) unsigned
Null: NO
Key:
Default: 0
Extra:
************* 4. row *************
Field: subnet
Type: int(4)
Null: NO
Key:
Default: NULL
Extra:
Now, I run a simple SELECT statement against the "id" column:
mysql> SELECT id FROM ipspace6 WHERE id='50552019118453823914642686339427860480';
+----------------------------------------+
| id |
+----------------------------------------+
| 50552019118453823730175245602332344320 |
| 50552019118453823730175245602332344320 |
| 50552019118453823914642686339427860480 |
| 50552019118453823914642686339427860480 |
+----------------------------------------+
...What the heck is going on here? Two of these results are valid, and two definitely are not.
It's not like I'm doing some super-complex nested query or anything, this is simple stuff, and it's driving me insane.
Help, anyone?
© Stack Overflow or respective owner