1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-29 08:21:15 +03:00
Files
mariadb-columnstore-engine/mysql-test/columnstore/basic/r/MCOL-5568-out-of-range.result
Sergey Zefirov b826fc1fd6 fix(datatypes, funcexp): Overflow detection for MCOL-5568 use case (and some other) (#2987)
We add intermediate calculations in int128_t when target is UBIGINT and
check for overflow before converting into the UBIGINT. This is so
because we can overflow on addition and multiplication, with (some)
signed operands or both unsigned.
2023-10-25 20:14:38 +03:00

62 lines
3.4 KiB
Plaintext

DROP DATABASE IF EXISTS MCOL5568;
CREATE DATABASE MCOL5568;
USE MCOL5568;
CREATE TABLE test_mult (
indemnity_paid INT(11),
n_clms TINYINT(3) UNSIGNED
) ENGINE=COLUMNSTORE;
INSERT INTO test_mult (indemnity_paid, n_clms) VALUES (-10, 1);
SELECT indemnity_paid, n_clms, indemnity_paid * n_clms FROM test_mult;
ERROR HY000: Internal error: MCS-2053: The result is out of range for function "*" using value(s): -10.000000 1.000000
SELECT indemnity_paid, n_clms, indemnity_paid + n_clms FROM test_mult;
ERROR HY000: Internal error: MCS-2053: The result is out of range for function "+" using value(s): -10.000000 1.000000
SELECT indemnity_paid, n_clms, (indemnity_paid + 9) + n_clms FROM test_mult;
indemnity_paid n_clms (indemnity_paid + 9) + n_clms
-10 1 0
CREATE TABLE test_mult2 (
indemnity_paid TINYINT,
n_clms TINYINT UNSIGNED
) ENGINE=COLUMNSTORE;
INSERT INTO test_mult2 (indemnity_paid, n_clms) VALUES (-10, 1);
SELECT indemnity_paid, n_clms, indemnity_paid * n_clms FROM test_mult2;
ERROR HY000: Internal error: MCS-2053: The result is out of range for function "*" using value(s): -10.000000 1.000000
SELECT indemnity_paid, n_clms, indemnity_paid + n_clms FROM test_mult2;
ERROR HY000: Internal error: MCS-2053: The result is out of range for function "+" using value(s): -10.000000 1.000000
SELECT indemnity_paid, n_clms, (indemnity_paid + 9) + n_clms FROM test_mult2;
indemnity_paid n_clms (indemnity_paid + 9) + n_clms
-10 1 0
CREATE TABLE test_mult3 (
indemnity_paid SMALLINT,
n_clms TINYINT UNSIGNED
) ENGINE=COLUMNSTORE;
INSERT INTO test_mult3 (indemnity_paid, n_clms) VALUES (-10, 1);
SELECT indemnity_paid, n_clms, indemnity_paid * n_clms FROM test_mult3;
ERROR HY000: Internal error: MCS-2053: The result is out of range for function "*" using value(s): -10.000000 1.000000
SELECT indemnity_paid, n_clms, indemnity_paid + n_clms FROM test_mult3;
ERROR HY000: Internal error: MCS-2053: The result is out of range for function "+" using value(s): -10.000000 1.000000
SELECT indemnity_paid, n_clms, (indemnity_paid + 9) + n_clms FROM test_mult3;
indemnity_paid n_clms (indemnity_paid + 9) + n_clms
-10 1 0
CREATE TABLE test_mult4 (
indemnity_paid INTEGER,
n_clms TINYINT UNSIGNED
) ENGINE=COLUMNSTORE;
INSERT INTO test_mult4 (indemnity_paid, n_clms) VALUES (-10, 1);
SELECT indemnity_paid, n_clms, indemnity_paid * n_clms FROM test_mult4;
ERROR HY000: Internal error: MCS-2053: The result is out of range for function "*" using value(s): -10.000000 1.000000
SELECT indemnity_paid, n_clms, indemnity_paid + n_clms FROM test_mult4;
ERROR HY000: Internal error: MCS-2053: The result is out of range for function "+" using value(s): -10.000000 1.000000
SELECT indemnity_paid, n_clms, (indemnity_paid + 9) + n_clms FROM test_mult4;
indemnity_paid n_clms (indemnity_paid + 9) + n_clms
-10 1 0
SELECT indemnity_paid, n_clms, n_clms * indemnity_paid FROM test_mult4;
ERROR HY000: Internal error: MCS-2053: The result is out of range for function "*" using value(s): 1.000000 -10.000000
SELECT indemnity_paid, n_clms, n_clms + indemnity_paid FROM test_mult4;
ERROR HY000: Internal error: MCS-2053: The result is out of range for function "+" using value(s): 1.000000 -10.000000
SELECT indemnity_paid, n_clms, n_clms + (indemnity_paid + 9) FROM test_mult4;
indemnity_paid n_clms n_clms + (indemnity_paid + 9)
-10 1 0
SELECT indemnity_paid, n_clms, n_clms - 2 FROM test_mult4;
ERROR HY000: Internal error: MCS-2053: The result is out of range for function "-" using value(s): 1.000000 2.000000
DROP DATABASE MCOL5568;