diff options
author | Dmitry Shulga <dmitry.shulga@mariadb.com> | 2022-01-20 16:25:43 +0700 |
---|---|---|
committer | Dmitry Shulga <dmitry.shulga@mariadb.com> | 2022-01-20 16:25:43 +0700 |
commit | a680e138a60d83c7ef72978af9ad8b580627502e (patch) | |
tree | a2c65388acc815bd2a27971af14c1dbd473bd81f | |
parent | 810ef9117a54f8dfbd362d959d46a2322f86a9d0 (diff) | |
download | mariadb-git-a680e138a60d83c7ef72978af9ad8b580627502e.tar.gz |
MDEV-24827: Follow-up patch to fix compilation warningbb-10.2-MDEV-24827
Mixed declarations and code is not allowed for C90 so
fix it to avoid compilation break on some platforms.
-rw-r--r-- | sql/sql_select.cc | 6 | ||||
-rw-r--r-- | tests/mysql_client_test.c | 7 |
2 files changed, 9 insertions, 4 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc index abdc79c1bf3..db8a63eeb48 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -12960,6 +12960,12 @@ return_zero_rows(JOIN *join, select_result *result, List<TABLE_LIST> &tables, if (!send_error) result->send_eof(); // Should be safe } + /* + JOIN::join_free() must be called after the virtual method + select::send_result_set_metadata() returned control since + implementation of this method could use data strutcures + that are released by the method JOIN::join_free(). + */ join->join_free(); DBUG_RETURN(0); diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index acd9b61327b..69e451c3019 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -19967,6 +19967,9 @@ static void test_mdev24827() int rc; MYSQL_STMT *stmt; unsigned long cursor = CURSOR_TYPE_READ_ONLY; + const char* query= + "SELECT t2.c1 AS c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1 " + "WHERE EXISTS (SELECT 1 FROM t1 WHERE c2 = -1) ORDER BY c1"; myheader("test_mdev24827"); @@ -19991,10 +19994,6 @@ static void test_mdev24827() "SELECT seq, seq FROM seq_1_to_20000"); myquery(rc); - const char* query= - "SELECT t2.c1 AS c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1 " - "WHERE EXISTS (SELECT 1 FROM t1 WHERE c2 = -1) ORDER BY c1"; - stmt= mysql_stmt_init(mysql); check_stmt(stmt); |