Commit 1fbd9bb2 authored by Robert Bindar's avatar Robert Bindar Committed by GitHub

Merge pull request #1261 from robertbindar/mdev-17978

MDEV-17978 Server crash in SHOW CREATE SEQUENCE on a broken view
parent d759f764
...@@ -24,3 +24,13 @@ ERROR 42S02: 'test.v1' is not a SEQUENCE ...@@ -24,3 +24,13 @@ ERROR 42S02: 'test.v1' is not a SEQUENCE
SELECT PREVIOUS VALUE FOR v1; SELECT PREVIOUS VALUE FOR v1;
ERROR 42S02: 'test.v1' is not a SEQUENCE ERROR 42S02: 'test.v1' is not a SEQUENCE
drop view v1; drop view v1;
#
# MDEV 17978 Server crashes in mysqld_show_create_get_fields
# upon SHOW CREATE SEQUENCE on a broken view
#
CREATE TABLE t1 (a INT);
CREATE VIEW v1 AS SELECT * FROM t1;
DROP TABLE t1;
SHOW CREATE SEQUENCE v1;
ERROR 42S02: 'test.v1' is not a SEQUENCE
DROP VIEW v1;
...@@ -27,3 +27,14 @@ SELECT NEXT VALUE FOR v1; ...@@ -27,3 +27,14 @@ SELECT NEXT VALUE FOR v1;
--error ER_NOT_SEQUENCE --error ER_NOT_SEQUENCE
SELECT PREVIOUS VALUE FOR v1; SELECT PREVIOUS VALUE FOR v1;
drop view v1; drop view v1;
--echo #
--echo # MDEV 17978 Server crashes in mysqld_show_create_get_fields
--echo # upon SHOW CREATE SEQUENCE on a broken view
--echo #
CREATE TABLE t1 (a INT);
CREATE VIEW v1 AS SELECT * FROM t1;
DROP TABLE t1;
--error ER_NOT_SEQUENCE
SHOW CREATE SEQUENCE v1;
DROP VIEW v1;
...@@ -1316,7 +1316,8 @@ mysqld_show_create_get_fields(THD *thd, TABLE_LIST *table_list, ...@@ -1316,7 +1316,8 @@ mysqld_show_create_get_fields(THD *thd, TABLE_LIST *table_list,
goto exit; goto exit;
} }
else if (lex->table_type == TABLE_TYPE_SEQUENCE && else if (lex->table_type == TABLE_TYPE_SEQUENCE &&
table_list->table->s->table_type != TABLE_TYPE_SEQUENCE) (!table_list->table ||
table_list->table->s->table_type != TABLE_TYPE_SEQUENCE))
{ {
my_error(ER_NOT_SEQUENCE, MYF(0), my_error(ER_NOT_SEQUENCE, MYF(0),
table_list->db.str, table_list->table_name.str); table_list->db.str, table_list->table_name.str);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment