1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-05-11 13:21:30 +03:00
mariadb-columnstore-engine/mysql-test/columnstore/basic/r/mcs186_dayofyear_function.result
Serguey Zefirov 39a976c39a fix(ubsan): MCOL-5844 - iron out UBSAN reports
The most important fix here is the fix of possible buffer overrun in
DATEFORMAT() function. A "%W" format, repeated enough times, would
overflow the 256-bytes buffer for result. Now we use ostringstream to
construct result and we are safe.

Changes in date/time projection functions made me fix difference between
us and server behavior. The new, better behavior is reflected in changes
in tests' results.

Also, there was incorrect logic in TRUNCATE() and ROUND() functions in
computing the decimal "shift."
2024-12-10 20:30:58 +04:00

30 lines
863 B
Plaintext

DROP DATABASE IF EXISTS mcs186_db;
CREATE DATABASE mcs186_db;
USE mcs186_db;
SET default_storage_engine=Columnstore;
CREATE TABLE t1 (a DATE, b DATETIME);
INSERT INTO t1 VALUES ('0-0-0', '0-0-0 0:0:0'), ('1212-12-12', '1212-12-11 11:11:11'), ('3333-03-03', '3333-3-4 3:33:33');
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` date DEFAULT NULL,
`b` datetime DEFAULT NULL
) ENGINE=Columnstore DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
SELECT DAYOFYEAR('1212-12-12 11:11:11');
DAYOFYEAR('1212-12-12 11:11:11')
347
SELECT DAYOFYEAR('2020-12-22');
DAYOFYEAR('2020-12-22')
357
SELECT a, DAYOFYEAR(a) FROM t1 ORDER BY 1;
a DAYOFYEAR(a)
0000-00-00 NULL
1212-12-12 347
3333-03-03 62
SELECT b, DAYOFYEAR(b) FROM t1 ORDER BY 1;
b DAYOFYEAR(b)
0000-00-00 00:00:00 NULL
1212-12-11 11:11:11 346
3333-03-04 03:33:33 63
DROP DATABASE mcs186_db;