vsql icon indicating copy to clipboard operation
vsql copied to clipboard

CAST(REAL AS BIGINT) boundary checking

Open elliotchance opened this issue 3 years ago • 0 comments

The following test does not work because we currently use i64 for all ints. Add these when this is no longer a limitation:

real.sql

CREATE TABLE foo (x REAL);
INSERT INTO foo (x) VALUES (123456789123456789123456789);
SELECT CAST(x AS BIGINT) FROM foo;
-- msg: CREATE TABLE 1
-- msg: INSERT 1
-- error 22003: numeric value out of range

double-precision.sql

CREATE TABLE foo (x DOUBLE PRECISION);
INSERT INTO foo (x) VALUES (123456789123456789123456789);
SELECT CAST(x AS BIGINT) FROM foo;
-- msg: CREATE TABLE 1
-- msg: INSERT 1
-- error 22003: numeric value out of range

elliotchance avatar Jul 24 '22 19:07 elliotchance