1
0
mirror of https://github.com/MariaDB/server.git synced 2025-09-02 09:41:40 +03:00

Fixed UNION support in view creation (BUG#4664)

This commit is contained in:
bell@sanja.is.com.ua
2004-08-24 19:50:16 +03:00
parent 5abb148d01
commit be31afd176
3 changed files with 86 additions and 56 deletions

View File

@@ -830,7 +830,7 @@ a b c
30 4 -60
50 6 -100
40 5 NULL
drop table t1;
drop table t1, t2;
drop view v1,v2,v3,v4,v5;
create database mysqltest;
create table mysqltest.t1 (a int, b int, primary key(a));
@@ -1040,7 +1040,6 @@ CREATE VIEW v02 AS SELECT * FROM DUAL;
ERROR HY000: No tables used
SHOW TABLES;
Tables_in_test table_type
t2 BASE TABLE
v4 VIEW
CREATE VIEW v1 AS SELECT EXISTS (SELECT 1 UNION SELECT 2);
select * from v1;
@@ -1058,3 +1057,20 @@ SHOW CREATE VIEW v1;
Table Create Table
v1 CREATE VIEW test.v1 AS select sql_no_cache connection_id() AS `f1`,pi() AS `f2`,current_user() AS `f3`,version() AS `f4`
drop view v1;
create table t1 (s1 int);
create table t2 (s2 int);
insert into t1 values (1), (2);
insert into t2 values (2), (3);
create view v1 as select * from t1,t2 union all select * from t1,t2;
select * from v1;
s1 s2
1 2
2 2
1 3
2 3
1 2
2 2
1 3
2 3
drop view v1;
drop tables t1, t2;

View File

@@ -693,7 +693,7 @@ insert into v1 select c, b, a from t2;
insert into v1 (z,y,x) select a+20,b+2,-100 from t2;
insert into v2 select b+1, a+10 from t2;
select * from t1;
drop table t1;
drop table t1, t2;
drop view v1,v2,v3,v4,v5;
#
@@ -1004,3 +1004,15 @@ drop table t1;
CREATE VIEW v1 (f1,f2,f3,f4) AS SELECT connection_id(), pi(), current_user(), version();
SHOW CREATE VIEW v1;
drop view v1;
#
# VIEW built over UNION
#
create table t1 (s1 int);
create table t2 (s2 int);
insert into t1 values (1), (2);
insert into t2 values (2), (3);
create view v1 as select * from t1,t2 union all select * from t1,t2;
select * from v1;
drop view v1;
drop tables t1, t2;