Skip to content

Commit f0bef17

Browse files
MDEV-30277: Assertion failure in Diagnostics_area::set_error_status
/ Reprepare_observer::report_error Analysis: Error is not reported when we hit invalid default parameter error Fix: Return appropriate value on error.
1 parent 6aa7498 commit f0bef17

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

mysql-test/main/ps.result

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6047,3 +6047,15 @@ a b c
60476047
1 1970-01-01 09:00:01 6
60486048
DROP TABLE t;
60496049
# End of 10.6 tests
6050+
# Beginning of 10.11 test
6051+
#
6052+
# MDEV-30277: Assertion failure in Diagnostics_area::set_error_status
6053+
# / Reprepare_observer::report_error
6054+
#
6055+
CREATE TABLE t (a INT);
6056+
PREPARE stmt FROM " DELETE FROM t LIMIT ?";
6057+
ALTER TABLE t FORCE;
6058+
EXECUTE stmt USING DEFAULT;
6059+
ERROR HY000: Default/ignore value is not supported for such parameter usage
6060+
DROP TABLE t;
6061+
# End of 10.11 test

mysql-test/main/ps.test

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5498,3 +5498,20 @@ SELECT * FROM t;
54985498

54995499
DROP TABLE t;
55005500
--echo # End of 10.6 tests
5501+
5502+
--echo # Beginning of 10.11 test
5503+
5504+
--echo #
5505+
--echo # MDEV-30277: Assertion failure in Diagnostics_area::set_error_status
5506+
--echo # / Reprepare_observer::report_error
5507+
--echo #
5508+
5509+
CREATE TABLE t (a INT);
5510+
PREPARE stmt FROM " DELETE FROM t LIMIT ?";
5511+
ALTER TABLE t FORCE;
5512+
--error ER_INVALID_DEFAULT_PARAM
5513+
EXECUTE stmt USING DEFAULT;
5514+
5515+
DROP TABLE t;
5516+
5517+
--echo # End of 10.11 test

sql/sql_parse.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4894,6 +4894,9 @@ mysql_execute_command(THD *thd, bool is_called_from_prepared_stmt)
48944894
DBUG_ASSERT(select_lex->limit_params.offset_limit == 0);
48954895
unit->set_limit(select_lex);
48964896

4897+
if (thd->is_error())
4898+
goto error;
4899+
48974900
MYSQL_DELETE_START(thd->query());
48984901
Protocol *save_protocol= NULL;
48994902

0 commit comments

Comments
 (0)