summaryrefslogtreecommitdiff
path: root/mysql-test/r/join.result
diff options
context:
space:
mode:
authorunknown <gkodinov@mysql.com>2006-06-08 13:34:03 +0300
committerunknown <gkodinov@mysql.com>2006-06-08 13:34:03 +0300
commita7566db788a2ce71751bce8fecf98507b8e37b8b (patch)
treee1c4829958100772d7ea539273bcee62c3e2e696 /mysql-test/r/join.result
parent63d6336465c13c010977c04a037468e55b68e9e0 (diff)
downloadmariadb-git-a7566db788a2ce71751bce8fecf98507b8e37b8b.tar.gz
Bug #15355: Common natural join column not resolved in prepared statement nested
query Problem: There was a wrong context assigned to the columns that were added in insert_fields() when expanding a '*'. When this is done in a prepared statement it causes fix_fields() to fail to find the table that these columns reference. Actually the right context is set in setup_natural_join_row_types() called at the end of setup_tables(). However when executed in a context of a prepared statement setup_tables() resets the context, but setup_natural_join_row_types() was not setting it to the correct value assuming it has already done so. Solution: The top-most, left-most NATURAL/USING join must be set as a first_name_resolution_table in context even when operating on prepared statements. mysql-test/r/join.result: testsuite for the bug mysql-test/t/join.test: testsuite for the bug sql/sql_base.cc: The context must be set even when executed as prepared statement.
Diffstat (limited to 'mysql-test/r/join.result')
-rw-r--r--mysql-test/r/join.result20
1 files changed, 20 insertions, 0 deletions
diff --git a/mysql-test/r/join.result b/mysql-test/r/join.result
index 86288caf398..48b7730481f 100644
--- a/mysql-test/r/join.result
+++ b/mysql-test/r/join.result
@@ -744,3 +744,23 @@ select a2 from ((t1 natural join t2) join t3 on b=c1) natural join t4;
a2
1
drop table t1,t2,t3,t4;
+create table t1 (c int, b int);
+create table t2 (a int, b int);
+create table t3 (b int, c int);
+create table t4 (y int, c int);
+create table t5 (y int, z int);
+insert into t1 values (3,2);
+insert into t2 values (1,2);
+insert into t3 values (2,3);
+insert into t4 values (1,3);
+insert into t5 values (1,4);
+prepare stmt1 from "select * from ((t3 natural join (t1 natural join t2))
+natural join t4) natural join t5";
+execute stmt1;
+y c b a z
+1 3 2 1 4
+select * from ((t3 natural join (t1 natural join t2)) natural join t4)
+natural join t5;
+y c b a z
+1 3 2 1 4
+drop table t1, t2, t3, t4, t5;