Skip to content

Commit 5eedd69

Browse files
author
Tor Didriksen
committed
Bug#35964157 mysql 8.1.0/8.2.0, mysqld got signal 11, when send sql, show parse_tre
SHOW PARSE_TREE is only supported for SELECT statements. Return ER_NOT_SUPPORTED_YET for all other kinds of statements. Change-Id: I994af8dee925936fba3beb042d70ba9bba3caf3c
1 parent 421e86d commit 5eedd69

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

mysql-test/r/show_parse_tree.result

+8
Original file line numberDiff line numberDiff line change
@@ -2577,3 +2577,11 @@ SHOW PARSE_TREE CREATE TABLE tab(id INT);
25772577
ERROR 42000: This version of MySQL doesn't yet support 'Parse tree display of this statement'
25782578
SHOW PARSE_TREE CREATE TABLE tab(id INVALID_SYNTAX);
25792579
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 'INVALID_SYNTAX)' at line 1
2580+
#
2581+
# Bug#35964157 mysql 8.1.0/8.2.0, mysqld got signal 11,
2582+
# when send sql, show parse_tre
2583+
#
2584+
SHOW PARSE_TREE SET @b:=(SELECT a FROM t);
2585+
ERROR 42000: This version of MySQL doesn't yet support 'Parse tree display of this statement'
2586+
SHOW PARSE_TREE CREATE SCHEMA s1;
2587+
ERROR 42000: This version of MySQL doesn't yet support 'Parse tree display of this statement'

mysql-test/t/show_parse_tree.test

+11
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,14 @@ SHOW PARSE_TREE UPDATE tab SET O = 1;
5858
SHOW PARSE_TREE CREATE TABLE tab(id INT);
5959
--error ER_PARSE_ERROR
6060
SHOW PARSE_TREE CREATE TABLE tab(id INVALID_SYNTAX);
61+
62+
--echo #
63+
--echo # Bug#35964157 mysql 8.1.0/8.2.0, mysqld got signal 11,
64+
--echo # when send sql, show parse_tre
65+
--echo #
66+
67+
--error ER_NOT_SUPPORTED_YET
68+
SHOW PARSE_TREE SET @b:=(SELECT a FROM t);
69+
70+
--error ER_NOT_SUPPORTED_YET
71+
SHOW PARSE_TREE CREATE SCHEMA s1;

sql/parse_tree_nodes.cc

+6
Original file line numberDiff line numberDiff line change
@@ -4682,6 +4682,12 @@ Sql_cmd *PT_show_grants::make_cmd(THD *thd) {
46824682
Sql_cmd *PT_show_parse_tree::make_cmd(THD *thd) {
46834683
LEX *lex = thd->lex;
46844684

4685+
// Several of the 'simple_statement:' do $$= nullptr;
4686+
if (m_parse_tree_stmt == nullptr) {
4687+
// my_error(ER_NOT_SUPPORTED_YET ....)
4688+
Parse_tree_root::get_printable_parse_tree(thd);
4689+
return nullptr;
4690+
}
46854691
std::string parse_tree_str = m_parse_tree_stmt->get_printable_parse_tree(thd);
46864692

46874693
if (parse_tree_str.empty()) return nullptr;

0 commit comments

Comments
 (0)