diff options
author | Robert Bindar <robert@mariadb.org> | 2019-12-05 18:26:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-05 18:26:52 +0200 |
commit | 1fbd9bb2c5d134209ac2aae073f7a78797c1c04e (patch) | |
tree | e6cea8f8bf86655cce2fe0dbd7111a711ee40b33 | |
parent | d759f764f6b115ca7ad7644ae3ee2e19c71c6138 (diff) | |
download | mariadb-git-1fbd9bb2c5d134209ac2aae073f7a78797c1c04e.tar.gz |
Merge pull request #1261 from robertbindar/mdev-17978
MDEV-17978 Server crash in SHOW CREATE SEQUENCE on a broken view
-rw-r--r-- | mysql-test/suite/sql_sequence/view.result | 10 | ||||
-rw-r--r-- | mysql-test/suite/sql_sequence/view.test | 11 | ||||
-rw-r--r-- | sql/sql_show.cc | 3 |
3 files changed, 23 insertions, 1 deletions
diff --git a/mysql-test/suite/sql_sequence/view.result b/mysql-test/suite/sql_sequence/view.result index bd773dcc042..0f39a637deb 100644 --- a/mysql-test/suite/sql_sequence/view.result +++ b/mysql-test/suite/sql_sequence/view.result @@ -24,3 +24,13 @@ ERROR 42S02: 'test.v1' is not a SEQUENCE SELECT PREVIOUS VALUE FOR v1; ERROR 42S02: 'test.v1' is not a SEQUENCE 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; diff --git a/mysql-test/suite/sql_sequence/view.test b/mysql-test/suite/sql_sequence/view.test index fe968604b5b..5b970432a34 100644 --- a/mysql-test/suite/sql_sequence/view.test +++ b/mysql-test/suite/sql_sequence/view.test @@ -27,3 +27,14 @@ SELECT NEXT VALUE FOR v1; --error ER_NOT_SEQUENCE SELECT PREVIOUS VALUE FOR 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; diff --git a/sql/sql_show.cc b/sql/sql_show.cc index a853d3df6f6..85e915bb65a 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1316,7 +1316,8 @@ mysqld_show_create_get_fields(THD *thd, TABLE_LIST *table_list, goto exit; } 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), table_list->db.str, table_list->table_name.str); |