1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-04-24 18:27:02 +03:00
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

32 lines
909 B
Plaintext

#
# INSTR() function
# Author: Bharath, bharath.bokka@mariadb.com
#
-- source ../include/have_columnstore.inc
--disable_warnings
DROP DATABASE IF EXISTS mcs259_db;
--enable_warnings
CREATE DATABASE mcs259_db;
USE mcs259_db;
CREATE TABLE t1 (a INT, b VARCHAR(30))ENGINE=Columnstore;
INSERT INTO t1 VALUES (NULL, NULL),(1, 'mariadb'),(2, 'columnstore'),(3, 'mariadb columnstore');
SELECT INSTR('abcdefghi', 'i') FROM t1 LIMIT 1;
SELECT INSTR('abcdefghi', 'z') FROM t1 LIMIT 1;
SELECT INSTR('pqrstuvwxyz', 'u') FROM t1 LIMIT 1;
SELECT INSTR('mnopmm', 'm') FROM t1 LIMIT 1;
SELECT INSTR('mnopmm', 'mm') FROM t1 LIMIT 1;
SELECT b, INSTR(b, 'mariadb') FROM t1 ORDER BY 1;
SELECT b, INSTR(concat(b,'pqr'), 'qr') FROM t1 ORDER BY 1;
SELECT b, INSTR(concat('pqr', b), 'qr') FROM t1 ORDER BY 1;
--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
SELECT b, INSTR(b) FROM t1 ORDER BY 1;
# Clean UP
DROP DATABASE mcs259_db;