View Ticket
Ticket Hash: dd6bffbfb6e61db9ecc9ea833d586427961ccc9d
Title: CAST to NUMERIC no longer converts to INTEGER
Status: Fixed Type: Code_Defect
Severity: Minor Priority: Immediate
Subsystem: Unknown Resolution: Fixed
Last Modified: 2019-06-10 18:33:24
Version Found In:
User Comments:
mrigger added on 2019-06-08 21:31:57: (text/x-fossil-wiki)
Consider the following example:

INSERT INTO t0(c0) VALUES ('1.0');
SELECT CAST(c0 AS NUMERIC) FROM t0; -- expected: 1, actual: 1.0

From the following part of the documentation, I would expect that the the value '1.0' is converted to 1:

Casting a TEXT or BLOB value into NUMERIC first does a forced conversion into REAL but then further converts the result into INTEGER if and only if the conversion from REAL to INTEGER is lossless and reversible.

I remember that this previously worked as I would expect. Could this be a regression caused by [67a68af5578f08d2]?

drh added on 2019-06-10 18:27:33: (text/x-fossil-wiki)
See also tickets [e8bedb2a184001] and [4c2d7639f076aa].