mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
return table list of fake_select in empty state to prevent using TABLE_LIST allocated on stack in next execution of PS (Bug #3577)
sql/sql_union.cc: return table list of fake_select in empty state to prevent using TABLE_LIST allocated on stack in next execution of PS tests/client_test.c: test of UNIONS with PS
This commit is contained in:
@@ -401,7 +401,10 @@ int st_select_lex_unit::exec()
|
|||||||
*/
|
*/
|
||||||
if (!(fake_select_lex->join= new JOIN(thd, item_list, thd->options,
|
if (!(fake_select_lex->join= new JOIN(thd, item_list, thd->options,
|
||||||
result)))
|
result)))
|
||||||
|
{
|
||||||
|
fake_select_lex->table_list.empty();
|
||||||
DBUG_RETURN(-1);
|
DBUG_RETURN(-1);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Fake st_select_lex should have item list for correctref_array
|
Fake st_select_lex should have item list for correctref_array
|
||||||
@@ -427,6 +430,8 @@ int st_select_lex_unit::exec()
|
|||||||
(ORDER*) NULL, NULL, (ORDER*) NULL,
|
(ORDER*) NULL, NULL, (ORDER*) NULL,
|
||||||
options_tmp | SELECT_NO_UNLOCK,
|
options_tmp | SELECT_NO_UNLOCK,
|
||||||
result, this, fake_select_lex);
|
result, this, fake_select_lex);
|
||||||
|
|
||||||
|
fake_select_lex->table_list.empty();
|
||||||
if (!res)
|
if (!res)
|
||||||
thd->limit_found_rows = (ulonglong)table->file->records + add_rows;
|
thd->limit_found_rows = (ulonglong)table->file->records + add_rows;
|
||||||
/*
|
/*
|
||||||
|
@@ -9397,6 +9397,41 @@ static void test_bug3035()
|
|||||||
mysql_real_query(mysql, stmt_text, strlen(stmt_text));
|
mysql_real_query(mysql, stmt_text, strlen(stmt_text));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_union2()
|
||||||
|
{
|
||||||
|
MYSQL_STMT *stmt;
|
||||||
|
int rc, i;
|
||||||
|
|
||||||
|
myheader("test_union2");
|
||||||
|
|
||||||
|
rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1");
|
||||||
|
myquery(rc);
|
||||||
|
|
||||||
|
rc= mysql_query(mysql,"CREATE TABLE t1(col1 INT,\
|
||||||
|
col2 VARCHAR(40), \
|
||||||
|
col3 SMALLINT,\
|
||||||
|
col4 TIMESTAMP)");
|
||||||
|
myquery(rc);
|
||||||
|
|
||||||
|
stmt= mysql_simple_prepare(mysql,
|
||||||
|
"select col1 FROM t1 where col1=1 union distinct \
|
||||||
|
select col1 FROM t1 where col1=2");
|
||||||
|
check_stmt(stmt);
|
||||||
|
|
||||||
|
for (i= 0; i < 3; i++)
|
||||||
|
{
|
||||||
|
rc= mysql_stmt_execute(stmt);
|
||||||
|
check_execute(stmt,rc);
|
||||||
|
assert(0 == my_process_stmt_result(stmt));
|
||||||
|
}
|
||||||
|
|
||||||
|
mysql_stmt_close(stmt);
|
||||||
|
|
||||||
|
rc= mysql_query(mysql, "DROP TABLE t1");
|
||||||
|
myquery(rc);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Read and parse arguments and MySQL options from my.cnf
|
Read and parse arguments and MySQL options from my.cnf
|
||||||
*/
|
*/
|
||||||
@@ -9676,6 +9711,7 @@ int main(int argc, char **argv)
|
|||||||
test_derived(); /* derived table with parameter BUG#3020 */
|
test_derived(); /* derived table with parameter BUG#3020 */
|
||||||
test_xjoin(); /* complex join test */
|
test_xjoin(); /* complex join test */
|
||||||
test_bug3035(); /* inserts of INT32_MAX/UINT32_MAX */
|
test_bug3035(); /* inserts of INT32_MAX/UINT32_MAX */
|
||||||
|
test_union2(); /* repeatable execution of union (Bug #3577) */
|
||||||
|
|
||||||
end_time= time((time_t *)0);
|
end_time= time((time_t *)0);
|
||||||
total_time+= difftime(end_time, start_time);
|
total_time+= difftime(end_time, start_time);
|
||||||
|
Reference in New Issue
Block a user