SQLite

Ticket Change Details
Login
Overview

Artifact ID: f550c0f0179a89552df5905e36ef0b96c4bda5438709fded13d0985929207cb8
Ticket: dd6bffbfb6e61db9ecc9ea833d586427961ccc9d
CAST to NUMERIC no longer converts to INTEGER
User & Date: mrigger 2019-06-08 21:31:57
Changes

  1. icomment:
    Consider the following example:
    
    <pre>
    CREATE TABLE t0 (c0 TEXT);
    INSERT INTO t0(c0) VALUES ('1.0');
    SELECT CAST(c0 AS NUMERIC) FROM t0; -- expected: 1, actual: 1.0
    </pre>
    
    From the following part of the documentation, I would expect that the the value '1.0' is converted to 1:
    
    <pre>
    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.
    </pre>
    
    I remember that this previously worked as I would expect. Could this be a regression caused by [67a68af5578f08d2]?
    
  2. login: "mrigger"
  3. mimetype: "text/x-fossil-wiki"
  4. severity changed to: "Critical"
  5. status changed to: "Open"
  6. title changed to: "CAST to NUMERIC no longer converts to INTEGER"
  7. type changed to: "Code_Defect"