diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2020-05-18 15:05:52 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2020-05-18 15:05:52 +0300 |
commit | faf6d0ef3f9323c6d24f8cdb6533ed23d1a6bb40 (patch) | |
tree | 086848c0085880912bec60369effef8ec449c91c /mysql-test/suite/vcol | |
parent | 386f168ab340791631e4d8979c4370ecef7e6b05 (diff) | |
parent | 5e12aca57f19f3e4f623e92637492edf8a69f42f (diff) | |
download | mariadb-git-faf6d0ef3f9323c6d24f8cdb6533ed23d1a6bb40.tar.gz |
Merge 10.3 into 10.4
Diffstat (limited to 'mysql-test/suite/vcol')
-rw-r--r-- | mysql-test/suite/vcol/r/vcol_misc.result | 52 | ||||
-rw-r--r-- | mysql-test/suite/vcol/t/vcol_misc.test | 61 |
2 files changed, 113 insertions, 0 deletions
diff --git a/mysql-test/suite/vcol/r/vcol_misc.result b/mysql-test/suite/vcol/r/vcol_misc.result index 6afdd120d26..1df31a4dfab 100644 --- a/mysql-test/suite/vcol/r/vcol_misc.result +++ b/mysql-test/suite/vcol/r/vcol_misc.result @@ -427,6 +427,26 @@ aaa Warnings: Warning 1918 Encountered illegal value '\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF7' when converting to DOUBLE # +# MDEV-22579 No error when inserting DEFAULT(non_virtual_column) into a virtual column +# +SET sql_mode=STRICT_ALL_TABLES; +CREATE OR REPLACE TABLE t1 ( +a INT NOT NULL DEFAULT 10, +b INT AS (a+1) VIRTUAL +) ENGINE=MyISAM; +INSERT INTO t1 (b) VALUES (10); +ERROR HY000: The value specified for generated column 'b' in table 't1' has been ignored +INSERT INTO t1 (b) VALUES (DEFAULT(a)); +ERROR HY000: The value specified for generated column 'b' in table 't1' has been ignored +INSERT INTO t1 (b) VALUES (DEFAULT); +INSERT INTO t1 VALUES (10,10); +ERROR HY000: The value specified for generated column 'b' in table 't1' has been ignored +INSERT INTO t1 VALUES (10,DEFAULT(a)); +ERROR HY000: The value specified for generated column 'b' in table 't1' has been ignored +INSERT INTO t1 VALUES (10, DEFAULT); +DROP TABLE t1; +SET sql_mode=DEFAULT; +# # End of 10.1 tests # # @@ -481,5 +501,37 @@ Warning 1264 Out of range value for column 'vi' at row 1 DROP TABLE t1; SET @sql_mode=@old_sql_mode; # +# MDEV-22579 No error when inserting DEFAULT(non_virtual_column) into a virtual column +# 10.2+ specific part +# +SET sql_mode=STRICT_ALL_TABLES; +CREATE OR REPLACE TABLE t1 ( +a INT NOT NULL DEFAULT 10, +b INT AS (a+1) VIRTUAL +) ENGINE=MyISAM; +EXECUTE IMMEDIATE 'INSERT INTO t1 (b) VALUES(?)' USING DEFAULT; +EXECUTE IMMEDIATE 'INSERT INTO t1 (b) VALUES(?)' USING IGNORE; +INSERT INTO t1 (b) VALUES (DEFAULT); +INSERT INTO t1 (b) VALUES (IGNORE); +SELECT * FROM t1; +a b +10 11 +10 11 +10 11 +10 11 +DELETE FROM t1; +EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES(10,?)' USING DEFAULT; +EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES(11,?)' USING IGNORE; +INSERT INTO t1 VALUES (12,DEFAULT); +INSERT INTO t1 VALUES (13,IGNORE); +SELECT * FROM t1; +a b +10 11 +11 12 +12 13 +13 14 +DROP TABLE t1; +SET sql_mode=DEFAULT; +# # End of 10.2 tests # diff --git a/mysql-test/suite/vcol/t/vcol_misc.test b/mysql-test/suite/vcol/t/vcol_misc.test index 39f4f4142e6..1bbd18d6eab 100644 --- a/mysql-test/suite/vcol/t/vcol_misc.test +++ b/mysql-test/suite/vcol/t/vcol_misc.test @@ -385,6 +385,36 @@ SELECT COLUMN_GET(@aaa, 'price' AS DECIMAL) aaa; SELECT COLUMN_GET(@aaa, 'price' AS INT) aaa; SELECT COLUMN_GET(@aaa, 'price' AS DOUBLE) aaa; + +--echo # +--echo # MDEV-22579 No error when inserting DEFAULT(non_virtual_column) into a virtual column +--echo # + +SET sql_mode=STRICT_ALL_TABLES; +CREATE OR REPLACE TABLE t1 ( + a INT NOT NULL DEFAULT 10, + b INT AS (a+1) VIRTUAL +) ENGINE=MyISAM; + +# Testing with a column list + +--error ER_WARNING_NON_DEFAULT_VALUE_FOR_GENERATED_COLUMN +INSERT INTO t1 (b) VALUES (10); +--error ER_WARNING_NON_DEFAULT_VALUE_FOR_GENERATED_COLUMN +INSERT INTO t1 (b) VALUES (DEFAULT(a)); +INSERT INTO t1 (b) VALUES (DEFAULT); + +# Testing without a column list +--error ER_WARNING_NON_DEFAULT_VALUE_FOR_GENERATED_COLUMN +INSERT INTO t1 VALUES (10,10); +--error ER_WARNING_NON_DEFAULT_VALUE_FOR_GENERATED_COLUMN +INSERT INTO t1 VALUES (10,DEFAULT(a)); +INSERT INTO t1 VALUES (10, DEFAULT); + +DROP TABLE t1; +SET sql_mode=DEFAULT; + + --echo # --echo # End of 10.1 tests --echo # @@ -443,5 +473,36 @@ DROP TABLE t1; SET @sql_mode=@old_sql_mode; --echo # +--echo # MDEV-22579 No error when inserting DEFAULT(non_virtual_column) into a virtual column +--echo # 10.2+ specific part +--echo # + +SET sql_mode=STRICT_ALL_TABLES; +CREATE OR REPLACE TABLE t1 ( + a INT NOT NULL DEFAULT 10, + b INT AS (a+1) VIRTUAL +) ENGINE=MyISAM; + +# Testing with column list + +EXECUTE IMMEDIATE 'INSERT INTO t1 (b) VALUES(?)' USING DEFAULT; +EXECUTE IMMEDIATE 'INSERT INTO t1 (b) VALUES(?)' USING IGNORE; +INSERT INTO t1 (b) VALUES (DEFAULT); +INSERT INTO t1 (b) VALUES (IGNORE); +SELECT * FROM t1; +DELETE FROM t1; + +# Testing without column list + +EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES(10,?)' USING DEFAULT; +EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES(11,?)' USING IGNORE; +INSERT INTO t1 VALUES (12,DEFAULT); +INSERT INTO t1 VALUES (13,IGNORE); +SELECT * FROM t1; + +DROP TABLE t1; +SET sql_mode=DEFAULT; + +--echo # --echo # End of 10.2 tests --echo # |