summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorunknown <bell@sanja.is.com.ua>2004-03-17 14:26:26 +0200
committerunknown <bell@sanja.is.com.ua>2004-03-17 14:26:26 +0200
commitf83cf4144065c12cad4007767e2e70d444fd0e05 (patch)
tree879e13469f1915539666e702fc32401e7f3a61d2 /tests
parent8242d1f19dcc00a8ad393485f19a1b3d806b8100 (diff)
downloadmariadb-git-f83cf4144065c12cad4007767e2e70d444fd0e05.tar.gz
DBUG_ASSERT(fixed == 0) added to fix_fields()
sql/item.cc: layout fixed fixed bug in prepared statements with subqueries and outer references sql/item.h: neg_transformer get thd argument to call fix_fields sql/item_cmpfunc.cc: DBUG_ASSERT(fixed == 0) added to fix_fields() fixed Item_in_optimizer fixed flag neg_arguments(), neg_transformer() call fix_field() on created items to avoid bouble fix field or non-called fixfields() sql/item_cmpfunc.h: neg_transformer get thd argument to call fix_fields fixed forgoten cleanup() call of parent class sql/item_func.cc: DBUG_ASSERT(fixed == 0) and fixed flag check added to fix_fields() sql/item_func.h: DBUG_ASSERT(fixed == 0) added to fix_fields() fixed forgoten cleanup() call of parent class sql/item_row.cc: DBUG_ASSERT(fixed == 0) added to fix_fields() added forgoten 'fixed' flag set sql/item_subselect.cc: DBUG_ASSERT(fixed == 0) added to fix_fields() fixed subquery transformation sql/sql_base.cc: check of fixed flag added sql/sql_derived.cc: fixed cleunup union in derived table during EXPLAIN command processing sql/sql_select.cc: thd argument add to function to allow call fix_fields() of new created items fixed EXPLAIN double preparation check of fixed flag added eliminate_not_funcs fixed for corrcet fix_fields call of new created items sql/sql_select.h: thd argument add to function to allow call fix_fields() of new created items sql/sql_union.cc: union processing fixed tests/client_test.c: layout fixed new test of outer references fron subqueries
Diffstat (limited to 'tests')
-rw-r--r--tests/client_test.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/tests/client_test.c b/tests/client_test.c
index fae8c3cd54d..31a53f6d81e 100644
--- a/tests/client_test.c
+++ b/tests/client_test.c
@@ -8206,7 +8206,6 @@ static void test_bug2247()
}
-
static void test_subqueries()
{
MYSQL_STMT *stmt;
@@ -8346,6 +8345,37 @@ static void test_bug2248()
myquery(rc);
}
+static void test_subqueries_ref()
+{
+ MYSQL_STMT *stmt;
+ int rc, i;
+ const char *query= "SELECT a as ccc from t1 where a+1=(SELECT 1+ccc from t1 where ccc+1=a+1 and a=1)";
+
+ myheader("test_subquery_ref");
+
+ rc = mysql_query(mysql, "DROP TABLE IF EXISTS t1");
+ myquery(rc);
+
+ rc= mysql_query(mysql,"CREATE TABLE t1 (a int);");
+ myquery(rc);
+
+ rc= mysql_query(mysql,
+ "insert into t1 values (1), (2), (3), (4), (5);");
+ myquery(rc);
+
+ stmt= mysql_prepare(mysql, query, strlen(query));
+ mystmt_init(stmt);
+ for (i= 0; i < 3; i++)
+ {
+ rc= mysql_execute(stmt);
+ mystmt(stmt, rc);
+ assert(1 == 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
@@ -8602,6 +8632,9 @@ int main(int argc, char **argv)
test_subqueries(); /* repeatable subqueries */
test_bad_union(); /* correct setup of UNION */
test_distinct(); /* distinct aggregate functions */
+ test_subqueries_ref(); /* outer reference in subqueries converted
+ Item_field -> Item_ref */
+
end_time= time((time_t *)0);