ClickHouse/dbms/tests/queries/0_stateless/00469_comparison_of_strings_containing_null_char.sql

34 lines
955 B
MySQL
Raw Normal View History

2017-06-20 12:23:06 +00:00
SELECT '**** constant-constant comparisons ****';
SELECT 'ab\0c' < 'ab\0d', 'ab\0c' > 'ab\0d';
SELECT 'a' < 'a\0b', 'a' > 'a\0b';
SELECT 'a\0\0\0\0' < 'a\0\0\0', 'a\0\0\0\0' > 'a\0\0\0';
2019-06-03 17:36:27 +00:00
DROP TABLE IF EXISTS strings_00469;
CREATE TABLE strings_00469(x String, y String) ENGINE = TinyLog;
2017-06-20 12:23:06 +00:00
2019-06-03 17:36:27 +00:00
INSERT INTO strings_00469 VALUES
2017-06-20 12:23:06 +00:00
('abcde\0', 'abcde'), ('aa\0a', 'aa\0b'), ('aa', 'aa\0'), ('a\0\0\0\0', 'a\0\0\0'), ('a\0\0', 'a\0'), ('a', 'a');
SELECT '**** vector-vector comparisons ****';
2019-06-03 17:36:27 +00:00
SELECT x < y, x > y FROM strings_00469;
2017-06-20 12:23:06 +00:00
SELECT '**** vector-constant comparisons ****';
2019-06-03 17:36:27 +00:00
SELECT x < 'aa', x > 'aa' FROM strings_00469;
2017-06-20 12:23:06 +00:00
SELECT '****';
2019-06-03 17:36:27 +00:00
SELECT x < 'a\0', x > 'a\0' FROM strings_00469;
2017-06-20 12:23:06 +00:00
SELECT '**** single-column sort ****'; -- Uses ColumnString::getPermutation()
2019-06-03 17:36:27 +00:00
SELECT * FROM strings_00469 ORDER BY x;
2017-06-20 12:23:06 +00:00
SELECT '**** multi-column sort ****'; -- Uses ColumnString::compareAt()
2019-06-03 17:36:27 +00:00
SELECT * FROM strings_00469 ORDER BY x, y;
2017-06-20 12:23:06 +00:00
2019-06-03 17:36:27 +00:00
DROP TABLE strings_00469;