diff options
Diffstat (limited to 'mysql-test/main/ps.result')
-rw-r--r-- | mysql-test/main/ps.result | 181 |
1 files changed, 181 insertions, 0 deletions
diff --git a/mysql-test/main/ps.result b/mysql-test/main/ps.result index 7fd30f3e..fb3681ca 100644 --- a/mysql-test/main/ps.result +++ b/mysql-test/main/ps.result @@ -5812,5 +5812,186 @@ GROUP_CONCAT(@x) 0 DROP TABLE t; # +# MDEV-15703: Crash in EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 (a INT DEFAULT ?)' USING DEFAULT +# +PREPARE stmt FROM 'CREATE OR REPLACE TABLE t1 (a INT DEFAULT ?)'; +EXECUTE stmt USING DEFAULT; +ERROR HY000: Default/ignore value is not supported for such parameter usage +DEALLOCATE PREPARE stmt; +PREPARE stmt FROM 'CREATE OR REPLACE TABLE t1 (a INT DEFAULT ?)'; +EXECUTE stmt USING IGNORE; +ERROR HY000: Default/ignore value is not supported for such parameter usage +DEALLOCATE PREPARE stmt; +EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 (a INT DEFAULT ?)' USING DEFAULT; +ERROR HY000: Default/ignore value is not supported for such parameter usage +EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 (a INT DEFAULT ?)' USING IGNORE; +ERROR HY000: Default/ignore value is not supported for such parameter usage +EXECUTE IMMEDIATE 'BEGIN NOT ATOMIC DECLARE a INT DEFAULT ?; END' USING DEFAULT; +ERROR HY000: Default/ignore value is not supported for such parameter usage +EXECUTE IMMEDIATE 'BEGIN NOT ATOMIC DECLARE a INT DEFAULT ?; END' USING IGNORE; +ERROR HY000: Default/ignore value is not supported for such parameter usage +CREATE PROCEDURE p1(a INT) SELECT 1; +EXECUTE IMMEDIATE 'CALL p1(?)' USING DEFAULT; +ERROR HY000: Default/ignore value is not supported for such parameter usage +EXECUTE IMMEDIATE 'CALL p1(?)' USING IGNORE; +ERROR HY000: Default/ignore value is not supported for such parameter usage +DROP PROCEDURE p1; +EXECUTE IMMEDIATE 'SELECT ? UNION SELECT 1' USING DEFAULT; +ERROR HY000: Default/ignore value is not supported for such parameter usage +EXECUTE IMMEDIATE 'SELECT ? UNION SELECT 1' USING IGNORE; +ERROR HY000: Default/ignore value is not supported for such parameter usage +EXECUTE IMMEDIATE 'SELECT * FROM (SELECT ? UNION ALL SELECT 1) AS derived' USING DEFAULT; +ERROR HY000: Default/ignore value is not supported for such parameter usage +EXECUTE IMMEDIATE 'SELECT * FROM (SELECT ? UNION ALL SELECT 1) AS derived' USING IGNORE; +ERROR HY000: Default/ignore value is not supported for such parameter usage +EXECUTE IMMEDIATE 'SELECT * FROM (SELECT ? UNION DISTINCT SELECT 1) AS derived' USING DEFAULT; +ERROR HY000: Default/ignore value is not supported for such parameter usage +EXECUTE IMMEDIATE 'SELECT * FROM (SELECT ? UNION DISTINCT SELECT 1) AS derived' USING IGNORE; +ERROR HY000: Default/ignore value is not supported for such parameter usage +# multi-update and DEFAULT +CREATE TABLE t1 (a INT, b INT DEFAULT a); +INSERT into t1 VALUES (1,2),(2,3); +CREATE TABLE t2 (a INT, b INT DEFAULT a); +INSERT INTO t2 VALUES (1,10),(2,30); +UPDATE t1,t2 SET t1.b = DEFAULT, t2.b = DEFAULT WHERE t1.a=t2.a; +SELECT * FROM t1; +a b +1 1 +2 2 +SELECT * FROM t2; +a b +1 1 +2 2 +# re-check the case for Prepared Statement with parameters +TRUNCATE TABLE t1; +TRUNCATE TABLE t2; +INSERT INTO t1 VALUES (1,2),(2,3); +INSERT INTO t2 VALUES (1,10),(2,30); +EXECUTE IMMEDIATE 'UPDATE t1,t2 SET t1.b = ?, t2.b = ? WHERE t1.a=t2.a' USING DEFAULT, DEFAULT; +SELECT * FROM t1; +a b +1 1 +2 2 +SELECT * FROM t2; +a b +1 1 +2 2 +DROP TABLE t1, t2; +# multi-update and IGNORE +CREATE TABLE t1 (a INT, b INT default a); +INSERT INTO t1 VALUES (1,2),(2,3); +CREATE TABLE t2 (a INT, b INT default a); +INSERT INTO t2 VALUES (1,10),(2,30); +UPDATE t1,t2 SET t1.b = IGNORE, t2.b = IGNORE WHERE t1.a=t2.a; +SELECT * FROM t1; +a b +1 2 +2 3 +SELECT * FROM t2; +a b +1 NULL +2 NULL +# re-check the case for Prepared Statement with parameters +TRUNCATE TABLE t1; +TRUNCATE TABLE t2; +INSERT INTO t1 VALUES (1,2),(2,3); +INSERT INTO t2 VALUES (1,10),(2,30); +EXECUTE IMMEDIATE 'UPDATE t1,t2 SET t1.b = ?, t2.b = ? WHERE t1.a=t2.a' USING IGNORE, IGNORE; +SELECT * FROM t1; +a b +1 2 +2 3 +SELECT * FROM t2; +a b +1 10 +2 30 +DROP TABLE t1, t2; +# multi-update and DEFAULT parameter (no default) +CREATE TABLE t1 (a INT, b INT NOT NULL); +INSERT INTO t1 VALUES (1,2),(2,3); +CREATE TABLE t2 (a INT, b INT NOT NULL); +INSERT INTO t2 VALUES (1,10),(2,30); +EXECUTE IMMEDIATE 'UPDATE t1,t2 SET t1.b = ?, t2.b = ? WHERE t1.a=t2.a' USING DEFAULT, DEFAULT; +ERROR HY000: Field 'b' doesn't have a default value +DROP TABLE t1, t2; +# multi-update and IGNORE parameter (no default) +CREATE TABLE t1 (a INT, b INT NOT NULL); +INSERT INTO t1 VALUES (1,2),(2,3); +CREATE TABLE t2 (a INT, b INT NOT NULL); +INSERT INTO t2 VALUES (1,10),(2,30); +EXECUTE IMMEDIATE 'UPDATE t1,t2 SET t1.b = ?, t2.b = ? WHERE t1.a=t2.a' USING IGNORE, IGNORE; +SELECT * FROM t1; +a b +1 2 +2 3 +SELECT * FROM t2; +a b +1 10 +2 30 +DROP TABLE t1, t2; +# +# MDEV-33549: Incorrect handling of UPDATE in PS mode in case a table's colum declared as NOT NULL +# +CREATE TABLE t1 (a INT, b INT DEFAULT NULL); +INSERT INTO t1 VALUES (20, 30); +EXECUTE IMMEDIATE 'UPDATE t1 SET b=?' USING DEFAULT; +SELECT * FROM t1; +a b +20 NULL +# Run twice the same update in PS mode to check +# that no memory relating issues taken place. +PREPARE stmt FROM 'UPDATE t1 SET b=?'; +EXECUTE stmt USING DEFAULT; +EXECUTE stmt USING DEFAULT; +# Clean up +DEALLOCATE PREPARE stmt; +DROP TABLE t1; +# The same test for multi-table update +CREATE TABLE t1 (a INT, b INT DEFAULT NULL); +CREATE TABLE t2 (a INT, c INT DEFAULT NULL); +INSERT INTO t1 VALUES (20, 30); +INSERT INTO t2 VALUES (20, 30); +EXECUTE IMMEDIATE 'UPDATE t1,t2 SET b=? WHERE t1.a=t2.a' USING DEFAULT; +SELECT * FROM t1; +a b +20 NULL +# Run twice the same multi-table update in PS mode to check +# that no memory relating issues taken place. +PREPARE stmt FROM 'UPDATE t1,t2 SET b=? WHERE t1.a=t2.a'; +EXECUTE stmt USING DEFAULT; +EXECUTE stmt USING DEFAULT; +DEALLOCATE PREPARE stmt; +# Clean up +DROP TABLE t1; +# This time checks that a default value for table's column +# represented by a function call is handled correctly on UPDATE in PS mode +CREATE TABLE t1 (a INT, b INT DEFAULT MOD(a, 3)); +INSERT INTO t1 VALUES (20, 30); +EXECUTE IMMEDIATE 'UPDATE t1, t2 SET b=? WHERE t1.a=t2.a' USING DEFAULT; +SELECT * FROM t1; +a b +20 2 +# Run twice the same multi-table update in PS mode to check +# that no memory relating issues taken place. +PREPARE stmt FROM 'UPDATE t1, t2 SET b=? WHERE t1.a=t2.a'; +EXECUTE stmt USING DEFAULT; +EXECUTE stmt USING DEFAULT; +# Clean up +DEALLOCATE PREPARE stmt; +DROP TABLE t1, t2; +# MDEV-33218: Assertion `active_arena->is_stmt_prepare_or_first_stmt_execute() || active_arena->state == Query_arena::STMT_SP_QUERY_ARGUMENTS' failed. in st_select_lex::fix_prepare_information +CREATE TABLE t1 AS SELECT 1 f; +PREPARE stmt FROM 'SHOW CREATE TABLE t1'; +DROP TABLE t1; +EXECUTE stmt; +ERROR 42S02: Table 'test.t1' doesn't exist +CREATE VIEW t1 AS SELECT 1; +EXECUTE stmt; +View Create View character_set_client collation_connection +t1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `t1` AS select 1 AS `1` latin1 latin1_swedish_ci +# Clean up +DEALLOCATE PREPARE stmt; +DROP VIEW t1; +# # End of 10.4 tests # |