Skip to content

Commit

Permalink
MDEV-22591 Debug build crashes on EXECUTE IMMEDIATE '... WHERE ?' USI…
Browse files Browse the repository at this point in the history
…NG IGNORE

Removing a wrong DBUG_ASSERT:
When Item_param gets "unfixed" in cleanup(), its "fixed" gets assigned
to false, while item_item keeps the value. So the assert was wrong.

Perhaps, instead of removing the assert, it was possible to reset
item_type to NO_VALUE in cleanup. But this is not very important:
it's implemented in 10.4 in a better way:
Item_param::is_fixed() always returns true and it does not need to be "unfixed".
  • Loading branch information
abarkov committed May 19, 2020
1 parent 0f9bfcc commit 996b9a9
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
17 changes: 17 additions & 0 deletions mysql-test/r/ps.result
Original file line number Diff line number Diff line change
Expand Up @@ -5373,5 +5373,22 @@ drop procedure p;
drop view v1;
drop table t1;
#
# MDEV-22591 Debug build crashes on EXECUTE IMMEDIATE '... WHERE ?' USING IGNORE
#
CREATE TABLE t1 (a INT);
EXECUTE IMMEDIATE 'SELECT * FROM t1 WHERE ?' USING IGNORE;
ERROR HY000: Default/ignore value is not supported for such parameter usage
EXECUTE IMMEDIATE 'SELECT * FROM t1 HAVING ?' USING IGNORE;
ERROR HY000: Default/ignore value is not supported for such parameter usage
EXECUTE IMMEDIATE 'SELECT * FROM t1 WHERE ?' USING 0;
a
EXECUTE IMMEDIATE 'SELECT * FROM t1 HAVING ?' USING 0;
a
DROP TABLE t1;
EXECUTE IMMEDIATE 'SHOW DATABASES WHERE ?' USING DEFAULT;
ERROR HY000: Default/ignore value is not supported for such parameter usage
EXECUTE IMMEDIATE 'SHOW DATABASES WHERE ?' USING 0;
Database
#
# End of 10.2 tests
#
17 changes: 17 additions & 0 deletions mysql-test/t/ps.test
Original file line number Diff line number Diff line change
Expand Up @@ -4885,6 +4885,23 @@ drop procedure p;
drop view v1;
drop table t1;


--echo #
--echo # MDEV-22591 Debug build crashes on EXECUTE IMMEDIATE '... WHERE ?' USING IGNORE
--echo #

CREATE TABLE t1 (a INT);
--error ER_INVALID_DEFAULT_PARAM
EXECUTE IMMEDIATE 'SELECT * FROM t1 WHERE ?' USING IGNORE;
--error ER_INVALID_DEFAULT_PARAM
EXECUTE IMMEDIATE 'SELECT * FROM t1 HAVING ?' USING IGNORE;
EXECUTE IMMEDIATE 'SELECT * FROM t1 WHERE ?' USING 0;
EXECUTE IMMEDIATE 'SELECT * FROM t1 HAVING ?' USING 0;
DROP TABLE t1;
--error ER_INVALID_DEFAULT_PARAM
EXECUTE IMMEDIATE 'SHOW DATABASES WHERE ?' USING DEFAULT;
EXECUTE IMMEDIATE 'SHOW DATABASES WHERE ?' USING 0;

--echo #
--echo # End of 10.2 tests
--echo #
1 change: 0 additions & 1 deletion sql/item.h
Original file line number Diff line number Diff line change
Expand Up @@ -3140,7 +3140,6 @@ class Item_param :public Item_basic_value,

enum Type type() const
{
DBUG_ASSERT(fixed || state == NO_VALUE);
return item_type;
}

Expand Down

0 comments on commit 996b9a9

Please sign in to comment.