From aebf2e49c8f2b6834c7bfcb0fe397a71f2084265 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 22 Aug 2005 17:04:55 +0300 Subject: [PATCH 1/2] Test case for BUG#6558 - Views: create fails with JOIN ... USING The bug is non-view specific, and it resulted from incorrect name resolution of natural join result columns. The bug is fixed by WL#2486. mysql-test/r/select.result: Added test case for BUG#6558 mysql-test/t/select.test: Added test case for BUG#6558 --- mysql-test/r/select.result | 10 ++++++++++ mysql-test/t/select.test | 13 +++++++++++++ 2 files changed, 23 insertions(+) diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index ed075c8a6ad..63ed0d187f0 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -2765,3 +2765,13 @@ f1 f2 f3 f4 2 2 2 one 2 2 2 two drop table t1,t2; +create table t1 (empnum smallint, grp int); +create table t2 (empnum int, name char(5)); +insert into t1 values(1,1); +insert into t2 values(1,'bob'); +create view v1 as select * from t2 inner join t1 using (empnum); +select * from v1; +empnum name grp +1 bob 1 +drop table t1,t2; +drop view v1; diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index b8975749fd6..fc0df8fb8b5 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -2358,3 +2358,16 @@ insert into t1 values (" 2", 2); insert into t2 values (" 2", " one "),(" 2", " two "); select * from t1 left join t2 on f1 = f3; drop table t1,t2; + +# +# Bug #6558 Views: CREATE VIEW fails with JOIN ... USING +# + +create table t1 (empnum smallint, grp int); +create table t2 (empnum int, name char(5)); +insert into t1 values(1,1); +insert into t2 values(1,'bob'); +create view v1 as select * from t2 inner join t1 using (empnum); +select * from v1; +drop table t1,t2; +drop view v1; From 9f70b1758eb1aa6f6f2e12ef31a7a55aa98af98d Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 22 Aug 2005 17:34:08 +0300 Subject: [PATCH 2/2] Test case for BUG#10646 The bug itself is fixed by WL #2486. mysql-test/r/select.result: Test for BUG#10646 mysql-test/t/select.test: Test for BUG#10646 --- mysql-test/r/select.result | 5 +++++ mysql-test/t/select.test | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index 63ed0d187f0..64946b88a41 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -2775,3 +2775,8 @@ empnum name grp 1 bob 1 drop table t1,t2; drop view v1; +create table t1 (pk int primary key, b int); +create table t2 (pk int primary key, c int); +select pk from t1 inner join t2 using (pk); +pk +drop table t1,t2; diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index fc0df8fb8b5..373aa73eec0 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -2371,3 +2371,13 @@ create view v1 as select * from t2 inner join t1 using (empnum); select * from v1; drop table t1,t2; drop view v1; + +# +# Bug #10646 Columns included in the join between two tables are ambigious +# in the select +# + +create table t1 (pk int primary key, b int); +create table t2 (pk int primary key, c int); +select pk from t1 inner join t2 using (pk); +drop table t1,t2;