summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Lindström <jan.lindstrom@mariadb.com>2020-04-08 18:09:28 +0300
committerJan Lindström <jan.lindstrom@mariadb.com>2020-04-08 18:09:28 +0300
commitc7ab676192dcd953a0860a9d021ff49f1c0dfbca (patch)
tree6710ccbf68c434f68f2ef56986dad9d5812ae1b6
parent6cf8f05fd9deb900a78898576b85753e09feddaa (diff)
downloadmariadb-git-c7ab676192dcd953a0860a9d021ff49f1c0dfbca.tar.gz
MDEV-22075 : Server crashes in wsrep_should_replicate_ddl_iterate upon CREATE VIEW
Fixed incorrect pointer reference when table is not available.
-rw-r--r--mysql-test/suite/galera/r/galera_create_view.result4
-rw-r--r--mysql-test/suite/galera/t/galera_create_view.test6
-rw-r--r--sql/wsrep_mysqld.cc3
3 files changed, 12 insertions, 1 deletions
diff --git a/mysql-test/suite/galera/r/galera_create_view.result b/mysql-test/suite/galera/r/galera_create_view.result
new file mode 100644
index 00000000000..19cc1abda3f
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_create_view.result
@@ -0,0 +1,4 @@
+connection node_2;
+connection node_1;
+CREATE OR REPLACE VIEW v AS WITH cte AS ( SELECT 1 ) SELECT * FROM cte;
+DROP VIEW v;
diff --git a/mysql-test/suite/galera/t/galera_create_view.test b/mysql-test/suite/galera/t/galera_create_view.test
new file mode 100644
index 00000000000..69b96a9536c
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_create_view.test
@@ -0,0 +1,6 @@
+--source include/galera_cluster.inc
+
+CREATE OR REPLACE VIEW v AS WITH cte AS ( SELECT 1 ) SELECT * FROM cte;
+
+# Cleanup
+DROP VIEW v;
diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc
index 99e8f0a52ec..6c2f20081a7 100644
--- a/sql/wsrep_mysqld.cc
+++ b/sql/wsrep_mysqld.cc
@@ -1744,7 +1744,8 @@ bool wsrep_should_replicate_ddl_iterate(THD* thd, const TABLE_LIST* table_list)
{
for (const TABLE_LIST* it= table_list; it; it= it->next_global)
{
- if (!wsrep_should_replicate_ddl(thd, it->table->s->db_type()->db_type))
+ if (it->table &&
+ !wsrep_should_replicate_ddl(thd, it->table->s->db_type()->db_type))
return false;
}
}