From 1327f40f9649f399fec14d1dff0f2bbc55da749a Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Mon, 13 Jan 2025 17:51:51 +0400 Subject: [PATCH] MDEV-35596 Assertion `type_handler()->result_type() == value.type_handler()->result_type()' failed in virtual bool Item_param::get_date(THD*, MYSQL_TIME*, date_mode_t) Adding mtr tests forgotten in the previous commit. --- mysql-test/main/ps_11bugs.result | 35 ++++++++++++++++++++++++++++++++ mysql-test/main/ps_11bugs.test | 34 +++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) diff --git a/mysql-test/main/ps_11bugs.result b/mysql-test/main/ps_11bugs.result index 87a3487141b..985654eb283 100644 --- a/mysql-test/main/ps_11bugs.result +++ b/mysql-test/main/ps_11bugs.result @@ -245,4 +245,39 @@ NULL DEALLOCATE PREPARE stmt; SET timestamp=DEFAULT; SET time_zone=DEFAULT; +# +# MDEV-35596 Assertion `type_handler()->result_type() == value.type_handler()->result_type()' failed in virtual bool Item_param::get_date(THD*, MYSQL_TIME*, date_mode_t) +# +CREATE TABLE t (c TIMESTAMP); +PREPARE s FROM 'DELETE FROM t WHERE c=?'; +EXECUTE s USING 1; +INSERT INTO t (c) VALUES (now()); +EXECUTE s USING NULL; +DROP TABLE t; +CREATE TABLE t (c TIMESTAMP); +INSERT INTO t (c) VALUES ('2001-01-01 10:20:30'); +PREPARE s FROM 'DELETE FROM t WHERE c=?'; +EXECUTE s USING 1; +Warnings: +Warning 1292 Truncated incorrect datetime value: '1' +EXECUTE s USING NULL; +DROP TABLE t; +CREATE TABLE t (c TIMESTAMP); +INSERT INTO t (c) VALUES ('2001-01-01 10:20:30'); +PREPARE s FROM 'DELETE FROM t WHERE c=?'; +EXECUTE s USING 1; +Warnings: +Warning 1292 Truncated incorrect datetime value: '1' +EXECUTE s USING DEFAULT; +ERROR HY000: Default/ignore value is not supported for such parameter usage +DROP TABLE t; +CREATE TABLE t (c TIMESTAMP); +INSERT INTO t (c) VALUES ('2001-01-01 10:20:30'); +PREPARE s FROM 'DELETE FROM t WHERE c=?'; +EXECUTE s USING 1; +Warnings: +Warning 1292 Truncated incorrect datetime value: '1' +EXECUTE s USING IGNORE; +ERROR HY000: Default/ignore value is not supported for such parameter usage +DROP TABLE t; # End of 10.5 tests diff --git a/mysql-test/main/ps_11bugs.test b/mysql-test/main/ps_11bugs.test index 7a0843e9352..7cb5708d062 100644 --- a/mysql-test/main/ps_11bugs.test +++ b/mysql-test/main/ps_11bugs.test @@ -254,4 +254,38 @@ DEALLOCATE PREPARE stmt; SET timestamp=DEFAULT; SET time_zone=DEFAULT; +--echo # +--echo # MDEV-35596 Assertion `type_handler()->result_type() == value.type_handler()->result_type()' failed in virtual bool Item_param::get_date(THD*, MYSQL_TIME*, date_mode_t) +--echo # + +CREATE TABLE t (c TIMESTAMP); +PREPARE s FROM 'DELETE FROM t WHERE c=?'; +EXECUTE s USING 1; +INSERT INTO t (c) VALUES (now()); +EXECUTE s USING NULL; +DROP TABLE t; + +CREATE TABLE t (c TIMESTAMP); +INSERT INTO t (c) VALUES ('2001-01-01 10:20:30'); +PREPARE s FROM 'DELETE FROM t WHERE c=?'; +EXECUTE s USING 1; +EXECUTE s USING NULL; +DROP TABLE t; + +CREATE TABLE t (c TIMESTAMP); +INSERT INTO t (c) VALUES ('2001-01-01 10:20:30'); +PREPARE s FROM 'DELETE FROM t WHERE c=?'; +EXECUTE s USING 1; +--error ER_INVALID_DEFAULT_PARAM +EXECUTE s USING DEFAULT; +DROP TABLE t; + +CREATE TABLE t (c TIMESTAMP); +INSERT INTO t (c) VALUES ('2001-01-01 10:20:30'); +PREPARE s FROM 'DELETE FROM t WHERE c=?'; +EXECUTE s USING 1; +--error ER_INVALID_DEFAULT_PARAM +EXECUTE s USING IGNORE; +DROP TABLE t; + --echo # End of 10.5 tests