I\'m getting the following error
#1690 - BIGINT UNSIGNED value is out of range in \'(
legends
.spawns
.quantity
-
I had the same problem, it occurred on a JOIN and couldn't figure out what was going on, in the end it was typo in the ON clause where I placed a minus sign instead of an equal sign. Might be stupid but I just didn't see it for about 30 minutes and maybe this could help someone!!!
I actualy found that question why I was searching for solution. If you have same problem as I do, try disabling "unsigned" parameter.
It is quite possible that your code fails here:
(
quantity - COUNT( game_moblist.spawn_id )
)
because if result of that matematic operation is less than zero it will fail with "unsigned" parameter.
sql_mode
worked in the MySQL client and Adminer, but not in CodeIgniter, where it counts. Casting didn't help either.
A simple arithmetic operation did the trick:
id - id_ex*1000000000 = id_sm
id_sm + id_ex*1000000000 = id
I don’t quite understand why everyone is saying unsigned. I have a special value in sql and also reported this error. I did it by converting this value to decimal.
cast(1000000000000000000 AS DECIMAL ( 35, 2 ))
To generalise the rule, MySQL will now refuse to substract an UNSIGNED operand from a SIGNED one.
Example : SELECT A - B;
will fail if A is SIGNED whereas B is UNSIGNED.
Workarounds: Add 1.0 factor to the signed operand, so it implicitly casts it to FLOAT, or use CAST (B AS SIGNED)
, or even swap (B - A) and change the algorithm accordingly.
I had similar problem, This error also come if our column have 0
value and we try to update it with -1
value.
In my case MySQL query were Failing if column1
is already have value 0
, i.e column1 = 0
For example:
UPDATE `table1` SET `column1` = `column1` - 1 WHERE `column2` = XYZ
This give error
BIGINT UNSIGNED value is out of range in ....
To counter this problem
UPDATE `table1`
SET `column1` = (
CASE WHEN `column1` < 1
THEN 0
ELSE (`column1` - 1)
end)
WHERE `column2` = 1
LIMIT 1