Incorrect representation of NUMERIC fields
CREATE TABLE TESTN18
(
ID INTEGER,
NUMERIC_18 NUMERIC(18,18)
);
INSERT INTO TESTN18 (ID, NUMERIC_18) VALUES (100, 9.223372036854775807);
SELECT NUMERIC_18 FROM TESTN18 WHERE ID = 100;
Expected:
NUMERIC_18
=====================
9.223372036854775807
Actual:
Looks like internal conversion to float / double somewhere.
When you edit a row and paste 9.223372036854775807 into NUMERIC_18 this will throw an error:
Notice the 9.223372036854776468 in error.
I can't see this in the next weeks, but asap I'll take a look By the way, it's strange that the simple update raised a error, can you copy the update and try in isql too?
9.223372036854776468 via isql also raises an error:
Statement failed, SQLSTATE = 22003 arithmetic exception, numeric overflow, or string truncation -numeric value is out of range
which is expected because 9.223372036854775807 is maximum that will fit in numeric(18,18) which is signed int64: eg max 2^63-1 and min is -(2^63)
Not sure but it feels like there might be some float/double conversation somewhere in the middle. If so this is bad because one might lose precision even not at the edge cases like this one.