1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-04-18 21:44:02 +03:00
mariadb-columnstore-engine/mysql-test/columnstore/basic/r/mcs185_dayname_function.result
Serguey Zefirov 0bc384d5f0 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-02 20:18:13 +03:00

30 lines
879 B
Plaintext

DROP DATABASE IF EXISTS mcs185_db;
CREATE DATABASE mcs185_db;
USE mcs185_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 DAYNAME('1212-12-12 11:11:11');
DAYNAME('1212-12-12 11:11:11')
Wednesday
SELECT DAYNAME('2020-12-22');
DAYNAME('2020-12-22')
Tuesday
SELECT a, DAYNAME(a) FROM t1 ORDER BY 1;
a DAYNAME(a)
0000-00-00 NULL
1212-12-12 Wednesday
3333-03-03 Tuesday
SELECT b, DAYNAME(b) FROM t1 ORDER BY 1;
b DAYNAME(b)
0000-00-00 00:00:00 NULL
1212-12-11 11:11:11 Tuesday
3333-03-04 03:33:33 Wednesday
DROP DATABASE mcs185_db;