mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 02:05:57 +01:00
MDEV-30415 MDEV-30415 PERIOD false positive overlap wtih utf8mb4_unicode_nopad_ci
The problem was earlier fixed by the patch for MDEV-30034. Adding MTR tests only.
This commit is contained in:
parent
62e137d4d7
commit
fb72dfbf7f
2 changed files with 208 additions and 0 deletions
|
@ -351,3 +351,101 @@ primary key(id, p without overlaps)
|
|||
) engine=heap partition by hash(id);
|
||||
update t set id = 1;
|
||||
drop table t, t1;
|
||||
#
|
||||
# MDEV-30415 PERIOD false positive overlap wtih utf8mb4_unicode_nopad_ci
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
datetime_column_name_1 DATETIME(6) NOT NULL,
|
||||
datetime_column_name_2 DATETIME(6) NOT NULL,
|
||||
text_column_name TEXT COLLATE utf8mb4_unicode_nopad_ci NOT NULL,
|
||||
PERIOD FOR period_name (datetime_column_name_1, datetime_column_name_2),
|
||||
UNIQUE KEY index_name (text_column_name(191),period_name WITHOUT OVERLAPS)
|
||||
) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci;
|
||||
INSERT INTO t1 (datetime_column_name_1, datetime_column_name_2, text_column_name)
|
||||
VALUES
|
||||
('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc'),
|
||||
('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc ');
|
||||
TRUNCATE TABLE t1;
|
||||
INSERT INTO t1 (datetime_column_name_1, datetime_column_name_2, text_column_name)
|
||||
VALUES
|
||||
('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc '),
|
||||
('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc');
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE `t1` (
|
||||
datetime_column_name_1 DATETIME(6) NOT NULL,
|
||||
datetime_column_name_2 DATETIME(6) NOT NULL,
|
||||
text_column_name TEXT COLLATE utf8mb4_unicode_nopad_ci NOT NULL,
|
||||
PERIOD FOR period_name (datetime_column_name_1, datetime_column_name_2),
|
||||
UNIQUE KEY index_name (text_column_name(191),period_name WITHOUT OVERLAPS)
|
||||
) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci;
|
||||
INSERT INTO t1 VALUES
|
||||
('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'def '),
|
||||
('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'def');
|
||||
TRUNCATE TABLE t1;
|
||||
INSERT INTO t1 VALUES
|
||||
('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'def'),
|
||||
('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'def '),
|
||||
('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'def ');
|
||||
SELECT *, LENGTH(text_column_name) FROM t1;
|
||||
datetime_column_name_1 datetime_column_name_2 text_column_name LENGTH(text_column_name)
|
||||
2000-01-01 00:00:00.000000 2001-01-01 00:00:00.000000 def 3
|
||||
2000-01-01 00:00:00.000000 2001-01-01 00:00:00.000000 def 4
|
||||
2000-01-01 00:00:00.000000 2001-01-01 00:00:00.000000 def 5
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
datetime_column_name_1 DATETIME(6) NOT NULL,
|
||||
datetime_column_name_2 DATETIME(6) NOT NULL,
|
||||
text_column_name TEXT COLLATE utf8mb4_unicode_nopad_ci NOT NULL,
|
||||
PERIOD FOR period_name (datetime_column_name_1, datetime_column_name_2),
|
||||
UNIQUE KEY index_name (text_column_name(3),period_name WITHOUT OVERLAPS)
|
||||
) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci;
|
||||
INSERT INTO t1 (datetime_column_name_1, datetime_column_name_2, text_column_name)
|
||||
VALUES
|
||||
('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc'),
|
||||
('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc ');
|
||||
ERROR 23000: Duplicate entry 'abc-2001-01-01 00:00:00.000000-2000-01-01 00:00:00.000000' for key 'index_name'
|
||||
TRUNCATE TABLE t1;
|
||||
INSERT INTO t1 (datetime_column_name_1, datetime_column_name_2, text_column_name)
|
||||
VALUES
|
||||
('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc '),
|
||||
('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc');
|
||||
ERROR 23000: Duplicate entry 'abc-2001-01-01 00:00:00.000000-2000-01-01 00:00:00.000000' for key 'index_name'
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
datetime_column_name_1 DATETIME(6) NOT NULL,
|
||||
datetime_column_name_2 DATETIME(6) NOT NULL,
|
||||
char_column_name CHAR(255) COLLATE utf8mb4_unicode_nopad_ci NOT NULL,
|
||||
PERIOD FOR period_name (datetime_column_name_1, datetime_column_name_2),
|
||||
UNIQUE KEY index_name (char_column_name(191),period_name WITHOUT OVERLAPS)
|
||||
) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci;
|
||||
INSERT INTO t1 (datetime_column_name_1, datetime_column_name_2, char_column_name)
|
||||
VALUES
|
||||
('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc'),
|
||||
('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc ');
|
||||
ERROR 23000: Duplicate entry 'abc-2001-01-01 00:00:00.000000-2000-01-01 00:00:00.000000' for key 'index_name'
|
||||
TRUNCATE TABLE t1;
|
||||
INSERT INTO t1 (datetime_column_name_1, datetime_column_name_2, char_column_name)
|
||||
VALUES
|
||||
('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc '),
|
||||
('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc');
|
||||
ERROR 23000: Duplicate entry 'abc-2001-01-01 00:00:00.000000-2000-01-01 00:00:00.000000' for key 'index_name'
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
datetime_column_name_1 DATETIME(6) NOT NULL,
|
||||
datetime_column_name_2 DATETIME(6) NOT NULL,
|
||||
char_column_name CHAR(255) COLLATE utf8mb4_unicode_nopad_ci NOT NULL,
|
||||
PERIOD FOR period_name (datetime_column_name_1, datetime_column_name_2),
|
||||
UNIQUE KEY index_name (char_column_name(3),period_name WITHOUT OVERLAPS)
|
||||
) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci;
|
||||
INSERT INTO t1 (datetime_column_name_1, datetime_column_name_2, char_column_name)
|
||||
VALUES
|
||||
('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc'),
|
||||
('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc ');
|
||||
ERROR 23000: Duplicate entry 'abc-2001-01-01 00:00:00.000000-2000-01-01 00:00:00.000000' for key 'index_name'
|
||||
TRUNCATE TABLE t1;
|
||||
INSERT INTO t1 (datetime_column_name_1, datetime_column_name_2, char_column_name)
|
||||
VALUES
|
||||
('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc '),
|
||||
('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc');
|
||||
ERROR 23000: Duplicate entry 'abc-2001-01-01 00:00:00.000000-2000-01-01 00:00:00.000000' for key 'index_name'
|
||||
DROP TABLE t1;
|
||||
|
|
|
@ -344,3 +344,113 @@ create or replace table t (id int, s date, e date, period for p(s,e),
|
|||
update t set id = 1;
|
||||
|
||||
drop table t, t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-30415 PERIOD false positive overlap wtih utf8mb4_unicode_nopad_ci
|
||||
--echo #
|
||||
|
||||
# The originally reported script with a TEXT column (slightly modified)
|
||||
CREATE TABLE t1 (
|
||||
datetime_column_name_1 DATETIME(6) NOT NULL,
|
||||
datetime_column_name_2 DATETIME(6) NOT NULL,
|
||||
text_column_name TEXT COLLATE utf8mb4_unicode_nopad_ci NOT NULL,
|
||||
PERIOD FOR period_name (datetime_column_name_1, datetime_column_name_2),
|
||||
UNIQUE KEY index_name (text_column_name(191),period_name WITHOUT OVERLAPS)
|
||||
) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci;
|
||||
INSERT INTO t1 (datetime_column_name_1, datetime_column_name_2, text_column_name)
|
||||
VALUES
|
||||
('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc'),
|
||||
('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc ');
|
||||
TRUNCATE TABLE t1;
|
||||
INSERT INTO t1 (datetime_column_name_1, datetime_column_name_2, text_column_name)
|
||||
VALUES
|
||||
('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc '),
|
||||
('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc');
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
# The script reported by Alice with a TEXT column
|
||||
CREATE TABLE `t1` (
|
||||
datetime_column_name_1 DATETIME(6) NOT NULL,
|
||||
datetime_column_name_2 DATETIME(6) NOT NULL,
|
||||
text_column_name TEXT COLLATE utf8mb4_unicode_nopad_ci NOT NULL,
|
||||
PERIOD FOR period_name (datetime_column_name_1, datetime_column_name_2),
|
||||
UNIQUE KEY index_name (text_column_name(191),period_name WITHOUT OVERLAPS)
|
||||
) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci;
|
||||
INSERT INTO t1 VALUES
|
||||
('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'def '),
|
||||
('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'def');
|
||||
TRUNCATE TABLE t1;
|
||||
INSERT INTO t1 VALUES
|
||||
('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'def'),
|
||||
('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'def '),
|
||||
('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'def ');
|
||||
--sorted_result
|
||||
SELECT *, LENGTH(text_column_name) FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
# A TEXT column with a short prefix
|
||||
CREATE TABLE t1 (
|
||||
datetime_column_name_1 DATETIME(6) NOT NULL,
|
||||
datetime_column_name_2 DATETIME(6) NOT NULL,
|
||||
text_column_name TEXT COLLATE utf8mb4_unicode_nopad_ci NOT NULL,
|
||||
PERIOD FOR period_name (datetime_column_name_1, datetime_column_name_2),
|
||||
UNIQUE KEY index_name (text_column_name(3),period_name WITHOUT OVERLAPS)
|
||||
) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci;
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO t1 (datetime_column_name_1, datetime_column_name_2, text_column_name)
|
||||
VALUES
|
||||
('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc'),
|
||||
('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc ');
|
||||
TRUNCATE TABLE t1;
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO t1 (datetime_column_name_1, datetime_column_name_2, text_column_name)
|
||||
VALUES
|
||||
('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc '),
|
||||
('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc');
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
# A CHAR with a long prefix
|
||||
CREATE TABLE t1 (
|
||||
datetime_column_name_1 DATETIME(6) NOT NULL,
|
||||
datetime_column_name_2 DATETIME(6) NOT NULL,
|
||||
char_column_name CHAR(255) COLLATE utf8mb4_unicode_nopad_ci NOT NULL,
|
||||
PERIOD FOR period_name (datetime_column_name_1, datetime_column_name_2),
|
||||
UNIQUE KEY index_name (char_column_name(191),period_name WITHOUT OVERLAPS)
|
||||
) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci;
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO t1 (datetime_column_name_1, datetime_column_name_2, char_column_name)
|
||||
VALUES
|
||||
('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc'),
|
||||
('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc ');
|
||||
TRUNCATE TABLE t1;
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO t1 (datetime_column_name_1, datetime_column_name_2, char_column_name)
|
||||
VALUES
|
||||
('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc '),
|
||||
('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc');
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
# A CHAR column with a short prefix
|
||||
CREATE TABLE t1 (
|
||||
datetime_column_name_1 DATETIME(6) NOT NULL,
|
||||
datetime_column_name_2 DATETIME(6) NOT NULL,
|
||||
char_column_name CHAR(255) COLLATE utf8mb4_unicode_nopad_ci NOT NULL,
|
||||
PERIOD FOR period_name (datetime_column_name_1, datetime_column_name_2),
|
||||
UNIQUE KEY index_name (char_column_name(3),period_name WITHOUT OVERLAPS)
|
||||
) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci;
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO t1 (datetime_column_name_1, datetime_column_name_2, char_column_name)
|
||||
VALUES
|
||||
('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc'),
|
||||
('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc ');
|
||||
TRUNCATE TABLE t1;
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO t1 (datetime_column_name_1, datetime_column_name_2, char_column_name)
|
||||
VALUES
|
||||
('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc '),
|
||||
('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc');
|
||||
DROP TABLE t1;
|
||||
|
|
Loading…
Add table
Reference in a new issue