mirror of
https://github.com/MariaDB/server.git
synced 2025-11-13 21:42:58 +03:00
Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-5.0
into sanja.is.com.ua:/home/bell/mysql/bk/work-5.0
This commit is contained in:
@@ -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;
|
||||
|
||||
#
|
||||
@@ -987,3 +987,61 @@ SHOW TABLES;
|
||||
CREATE VIEW v1 AS SELECT EXISTS (SELECT 1 UNION SELECT 2);
|
||||
select * from v1;
|
||||
drop view v1;
|
||||
|
||||
#
|
||||
# using VIEW where table is required
|
||||
#
|
||||
create table t1 (col1 int,col2 char(22));
|
||||
create view v1 as select * from t1;
|
||||
-- error 1346
|
||||
create index i1 on v1 (col1);
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# connection_id(), pi(), current_user(), version() representation test
|
||||
#
|
||||
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;
|
||||
|
||||
#
|
||||
# Aggregate functions in view list
|
||||
#
|
||||
create table t1 (col1 int);
|
||||
insert into t1 values (1);
|
||||
create view v1 as select count(*) from t1;
|
||||
insert into t1 values (null);
|
||||
select * from v1;
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Showing VIEW with VIEWs in subquery
|
||||
#
|
||||
create table t1 (a int);
|
||||
create table t2 (a int);
|
||||
create view v1 as select a from t1;
|
||||
create view v2 as select a from t2 where a in (select a from v1);
|
||||
show create view v2;
|
||||
drop view v2, v1;
|
||||
drop table t1, t2;
|
||||
|
||||
#
|
||||
# SHOW VIEW view with name with spaces
|
||||
#
|
||||
CREATE VIEW `v 1` AS select 5 AS `5`;
|
||||
show create view `v 1`;
|
||||
drop view `v 1`;
|
||||
|
||||
Reference in New Issue
Block a user