summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorunknown <bell@sanja.is.com.ua>2004-05-03 13:58:01 +0300
committerunknown <bell@sanja.is.com.ua>2004-05-03 13:58:01 +0300
commitbcbaefcf975f0f1bc036ef3b5d3bf58c52987940 (patch)
tree4e13ef8e7b0f0d06a77d0934ffaf94d0fb436f59 /tests
parent73ff0958c05d771b719538135bc146cc5ffd9aae (diff)
downloadmariadb-git-bcbaefcf975f0f1bc036ef3b5d3bf58c52987940.tar.gz
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
Diffstat (limited to 'tests')
-rw-r--r--tests/client_test.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/client_test.c b/tests/client_test.c
index 5ec39bdf725..7db66ffafc2 100644
--- a/tests/client_test.c
+++ b/tests/client_test.c
@@ -9397,6 +9397,41 @@ static void test_bug3035()
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
*/
@@ -9676,6 +9711,7 @@ int main(int argc, char **argv)
test_derived(); /* derived table with parameter BUG#3020 */
test_xjoin(); /* complex join test */
test_bug3035(); /* inserts of INT32_MAX/UINT32_MAX */
+ test_union2(); /* repeatable execution of union (Bug #3577) */
end_time= time((time_t *)0);
total_time+= difftime(end_time, start_time);