Skip to content

Commit 4267e75

Browse files
committed
Bug #38001000: MySQL #14: an assertion failure
Improved the check for subqueries in INSTALL COMPONENT SET Change-Id: I12a7ccad21904f18eead174edf6d3164134d9645
1 parent f5f1381 commit 4267e75

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

mysql-test/r/component_set.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ UNINSTALL COMPONENT "file://component_validate_password";
3232
CREATE TABLE t1(a INT);
3333
INSERT INTO t1 VALUES (1),(2);
3434
INSTALL COMPONENT "file://component_validate_password" SET length = (SELECT a FROM t1);
35-
ERROR HY000: You may only use constant expressions with SET
35+
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(SELECT a FROM t1)' at line 1
3636
DROP TABLE t1;
3737
SET @gizmo = 32;
3838
INSTALL COMPONENT "file://component_validate_password" SET length = @gizmo;

mysql-test/t/component_set.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ UNINSTALL COMPONENT "file://component_validate_password";
4444

4545
CREATE TABLE t1(a INT);
4646
INSERT INTO t1 VALUES (1),(2);
47-
--error ER_SET_CONSTANTS_ONLY
47+
--error ER_PARSE_ERROR
4848
INSTALL COMPONENT "file://component_validate_password" SET length = (SELECT a FROM t1);
4949
DROP TABLE t1;
5050

sql/parse_tree_nodes.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4843,7 +4843,9 @@ PT_install_component::PT_install_component(
48434843

48444844
Sql_cmd *PT_install_component::make_cmd(THD *thd) {
48454845
thd->lex->sql_command = SQLCOM_INSTALL_COMPONENT;
4846-
4846+
thd->lex->expr_allows_subquery = false;
4847+
auto f =
4848+
create_scope_guard([thd]() { thd->lex->expr_allows_subquery = true; });
48474849
if (!m_set_elements->is_empty()) {
48484850
Parse_context pc(thd, thd->lex->current_query_block());
48494851
for (auto &elt : *m_set_elements) {

0 commit comments

Comments
 (0)