MDEV-28190 sql_mode makes MDEV-371 virtual column expressions nondeterministic

This problem was fixed earlier by MDEV-27653.
Adding MTR tests only.
This commit is contained in:
Alexander Barkov 2023-04-06 14:50:26 +04:00
parent 54715a1074
commit ed2adc8c6f
5 changed files with 213 additions and 0 deletions

View file

@ -0,0 +1,31 @@
--echo #
--echo # MDEV-28190 sql_mode makes MDEV-371 virtual column expressions nondeterministic
--echo #
CREATE TABLE t1 (a INT,b CHAR(20));
SHOW CREATE TABLE t1;
CREATE UNIQUE INDEX bi USING HASH ON t1 (b);
INSERT INTO t1 VALUES (0,0);
SET sql_mode='pad_char_to_full_length';
DELETE FROM t1;
DROP TABLE t1;
SET sql_mode='';
CREATE TABLE t1 (a INT,b CHAR(20));
SHOW CREATE TABLE t1;
CREATE UNIQUE INDEX bi USING HASH ON t1 (b);
SET sql_mode='pad_char_to_full_length';
INSERT INTO t1 VALUES (0,0);
DELETE FROM t1;
DROP TABLE t1;
SET sql_mode='';
CREATE OR REPLACE TABLE t1 (a CHAR(20),b CHAR(20));
SHOW CREATE TABLE t1;
CREATE UNIQUE INDEX bi USING HASH ON t1 (b);
INSERT INTO t1 VALUES (0,0);
SET sql_mode='pad_char_to_full_length';
DELETE FROM t1;
DROP TABLE t1;

View file

@ -0,0 +1,94 @@
#
# Start of 10.4 tests
#
#
# MDEV-28190 sql_mode makes MDEV-371 virtual column expressions nondeterministic
#
SET default_storage_engine=MyISAM;
#
# MDEV-28190 sql_mode makes MDEV-371 virtual column expressions nondeterministic
#
CREATE TABLE t1 (a INT,b CHAR(20));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` char(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
CREATE UNIQUE INDEX bi USING HASH ON t1 (b);
INSERT INTO t1 VALUES (0,0);
SET sql_mode='pad_char_to_full_length';
DELETE FROM t1;
DROP TABLE t1;
SET sql_mode='';
CREATE TABLE t1 (a INT,b CHAR(20));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` char(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
CREATE UNIQUE INDEX bi USING HASH ON t1 (b);
SET sql_mode='pad_char_to_full_length';
INSERT INTO t1 VALUES (0,0);
DELETE FROM t1;
DROP TABLE t1;
SET sql_mode='';
CREATE OR REPLACE TABLE t1 (a CHAR(20),b CHAR(20));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` char(20) DEFAULT NULL,
`b` char(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
CREATE UNIQUE INDEX bi USING HASH ON t1 (b);
INSERT INTO t1 VALUES (0,0);
SET sql_mode='pad_char_to_full_length';
DELETE FROM t1;
DROP TABLE t1;
SET default_storage_engine=MEMORY;
#
# MDEV-28190 sql_mode makes MDEV-371 virtual column expressions nondeterministic
#
CREATE TABLE t1 (a INT,b CHAR(20));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` char(20) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
CREATE UNIQUE INDEX bi USING HASH ON t1 (b);
INSERT INTO t1 VALUES (0,0);
SET sql_mode='pad_char_to_full_length';
DELETE FROM t1;
DROP TABLE t1;
SET sql_mode='';
CREATE TABLE t1 (a INT,b CHAR(20));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` char(20) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
CREATE UNIQUE INDEX bi USING HASH ON t1 (b);
SET sql_mode='pad_char_to_full_length';
INSERT INTO t1 VALUES (0,0);
DELETE FROM t1;
DROP TABLE t1;
SET sql_mode='';
CREATE OR REPLACE TABLE t1 (a CHAR(20),b CHAR(20));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` char(20) DEFAULT NULL,
`b` char(20) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
CREATE UNIQUE INDEX bi USING HASH ON t1 (b);
INSERT INTO t1 VALUES (0,0);
SET sql_mode='pad_char_to_full_length';
DELETE FROM t1;
DROP TABLE t1;
SET default_storage_engine=DEFAULT;
#
# End of 10.4 tests
#

View file

@ -0,0 +1,19 @@
--echo #
--echo # Start of 10.4 tests
--echo #
--echo #
--echo # MDEV-28190 sql_mode makes MDEV-371 virtual column expressions nondeterministic
--echo #
SET default_storage_engine=MyISAM;
--source include/sql_mode_pad_char_to_full_length.inc
SET default_storage_engine=MEMORY;
--source include/sql_mode_pad_char_to_full_length.inc
SET default_storage_engine=DEFAULT;
--echo #
--echo # End of 10.4 tests
--echo #

View file

@ -0,0 +1,51 @@
SET default_storage_engine=InnoDB;
#
# Start of 10.4 tests
#
#
# MDEV-28190 sql_mode makes MDEV-371 virtual column expressions nondeterministic
#
#
# MDEV-28190 sql_mode makes MDEV-371 virtual column expressions nondeterministic
#
CREATE TABLE t1 (a INT,b CHAR(20));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` char(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
CREATE UNIQUE INDEX bi USING HASH ON t1 (b);
INSERT INTO t1 VALUES (0,0);
SET sql_mode='pad_char_to_full_length';
DELETE FROM t1;
DROP TABLE t1;
SET sql_mode='';
CREATE TABLE t1 (a INT,b CHAR(20));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` char(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
CREATE UNIQUE INDEX bi USING HASH ON t1 (b);
SET sql_mode='pad_char_to_full_length';
INSERT INTO t1 VALUES (0,0);
DELETE FROM t1;
DROP TABLE t1;
SET sql_mode='';
CREATE OR REPLACE TABLE t1 (a CHAR(20),b CHAR(20));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` char(20) DEFAULT NULL,
`b` char(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
CREATE UNIQUE INDEX bi USING HASH ON t1 (b);
INSERT INTO t1 VALUES (0,0);
SET sql_mode='pad_char_to_full_length';
DELETE FROM t1;
DROP TABLE t1;
#
# End of 10.4 tests
#

View file

@ -0,0 +1,18 @@
--source include/have_innodb.inc
SET default_storage_engine=InnoDB;
--echo #
--echo # Start of 10.4 tests
--echo #
--echo #
--echo # MDEV-28190 sql_mode makes MDEV-371 virtual column expressions nondeterministic
--echo #
--source include/sql_mode_pad_char_to_full_length.inc
--echo #
--echo # End of 10.4 tests
--echo #