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/mcs225_replace_function.result
Sergey Zefirov b53c231ca6 MCOL-271 empty strings should not be NULLs (#2794)
This patch improves handling of NULLs in textual fields in ColumnStore.
Previously empty strings were considered NULLs and it could be a problem
if data scheme allows for empty strings. It was also one of major
reasons of behavior difference between ColumnStore and other engines in
MariaDB family.

Also, this patch fixes some other bugs and incorrect behavior, for
example, incorrect comparison for "column <= ''" which evaluates to
constant True for all purposes before this patch.
2023-03-30 21:18:29 +03:00

45 lines
983 B
Plaintext

DROP DATABASE IF EXISTS mcs225_db;
CREATE DATABASE mcs225_db;
USE mcs225_db;
CREATE TABLE t1 (a INT, b CHAR(20))ENGINE=Columnstore;
INSERT INTO t1 VALUES (NULL, NULL),(1, 'aaa'),(2, 'abcabc'),(3, 'cccbba'),(4, 'dddd'),(5, 'pqrs');
SELECT REPLACE('abbcccb', 'b', 'z');
REPLACE('abbcccb', 'b', 'z')
azzcccz
SELECT REPLACE('xyz', 'z', 'ppp');
REPLACE('xyz', 'z', 'ppp')
xyppp
SELECT b, REPLACE(b, 'a', 'mcs') FROM t1 ORDER BY 1;
b REPLACE(b, 'a', 'mcs')
NULL NULL
aaa mcsmcsmcs
abcabc mcsbcmcsbc
cccbba cccbbmcs
dddd dddd
pqrs pqrs
SELECT b, REPLACE(b, 'b', 'oo') FROM t1 ORDER BY 1;
b REPLACE(b, 'b', 'oo')
NULL NULL
aaa aaa
abcabc aoocaooc
cccbba cccooooa
dddd dddd
pqrs pqrs
SELECT b, REPLACE(b, 'pqrs', 'a') FROM t1 ORDER BY 1;
b REPLACE(b, 'pqrs', 'a')
NULL NULL
aaa aaa
abcabc abcabc
cccbba cccbba
dddd dddd
pqrs a
SELECT b, REPLACE(b, 'dd', 'n') FROM t1 ORDER BY 1;
b REPLACE(b, 'dd', 'n')
NULL NULL
aaa aaa
abcabc abcabc
cccbba cccbba
dddd nn
pqrs pqrs
DROP DATABASE mcs225_db;