2004-09-07 18:58:02 +02:00
|
|
|
--disable_warnings
|
2004-09-08 09:18:04 +02:00
|
|
|
drop table if exists t1Aa,t2Aa,v1Aa,v2Aa;
|
|
|
|
drop view if exists t1Aa,t2Aa,v1Aa,v2Aa;
|
2004-09-07 18:58:02 +02:00
|
|
|
drop database if exists MySQLTest;
|
|
|
|
--enable_warnings
|
|
|
|
|
2004-09-08 09:18:04 +02:00
|
|
|
#
|
|
|
|
# different cases in VIEW
|
|
|
|
#
|
2004-09-07 18:58:02 +02:00
|
|
|
create database MySQLTest;
|
|
|
|
use MySQLTest;
|
|
|
|
create table TaB (Field int);
|
|
|
|
create view ViE as select * from TAb;
|
|
|
|
show create table VIe;
|
|
|
|
drop database MySQLTest;
|
2004-09-07 19:40:16 +02:00
|
|
|
use test;
|
2004-09-08 09:18:04 +02:00
|
|
|
|
|
|
|
#
|
|
|
|
# test of updating and fetching from the same table check
|
|
|
|
#
|
|
|
|
create table t1Aa (col1 int);
|
2005-03-28 14:13:31 +02:00
|
|
|
create table t2aA (col1 int);
|
|
|
|
create view v1Aa as select * from t1aA;
|
|
|
|
create view v2aA as select * from v1aA;
|
|
|
|
create view v3Aa as select v2Aa.col1 from v2aA,t2Aa where v2Aa.col1 = t2aA.col1;
|
2005-09-02 08:50:17 +02:00
|
|
|
-- error 1443
|
2005-03-28 14:13:31 +02:00
|
|
|
insert into v2Aa values ((select max(col1) from v1aA));
|
2005-09-02 08:50:17 +02:00
|
|
|
-- error 1443
|
2005-03-28 14:13:31 +02:00
|
|
|
insert into t1aA values ((select max(col1) from v1Aa));
|
2005-09-02 08:50:17 +02:00
|
|
|
-- error 1443
|
2004-09-08 09:18:04 +02:00
|
|
|
insert into v2aA values ((select max(col1) from v1aA));
|
2005-09-02 08:50:17 +02:00
|
|
|
-- error 1443
|
2005-03-28 14:13:31 +02:00
|
|
|
insert into v2Aa values ((select max(col1) from t1Aa));
|
|
|
|
-- error 1093
|
|
|
|
insert into t1aA values ((select max(col1) from t1Aa));
|
2005-09-02 08:50:17 +02:00
|
|
|
-- error 1443
|
2005-03-28 14:13:31 +02:00
|
|
|
insert into v2aA values ((select max(col1) from t1aA));
|
|
|
|
-- error 1093
|
|
|
|
insert into v2Aa values ((select max(col1) from v2aA));
|
2005-09-02 08:50:17 +02:00
|
|
|
-- error 1443
|
2005-03-28 14:13:31 +02:00
|
|
|
insert into t1Aa values ((select max(col1) from v2Aa));
|
|
|
|
-- error 1093
|
|
|
|
insert into v2aA values ((select max(col1) from v2Aa));
|
2005-09-02 08:50:17 +02:00
|
|
|
-- error 1443
|
2005-03-28 14:13:31 +02:00
|
|
|
insert into v3Aa (col1) values ((select max(col1) from v1Aa));
|
2005-09-02 08:50:17 +02:00
|
|
|
-- error 1443
|
2005-03-28 14:13:31 +02:00
|
|
|
insert into v3aA (col1) values ((select max(col1) from t1aA));
|
2005-09-02 08:50:17 +02:00
|
|
|
-- error 1443
|
2005-03-28 14:13:31 +02:00
|
|
|
insert into v3Aa (col1) values ((select max(col1) from v2aA));
|
|
|
|
drop view v3aA,v2Aa,v1aA;
|
2004-09-08 09:18:04 +02:00
|
|
|
drop table t1Aa,t2Aa;
|
2004-11-24 18:48:30 +01:00
|
|
|
|
|
|
|
#
|
|
|
|
# aliases in VIEWs
|
|
|
|
#
|
|
|
|
create table t1Aa (col1 int);
|
|
|
|
create view v1Aa as select col1 from t1Aa as AaA;
|
|
|
|
show create view v1AA;
|
|
|
|
drop view v1AA;
|
|
|
|
select Aaa.col1 from t1Aa as AaA;
|
|
|
|
create view v1Aa as select Aaa.col1 from t1Aa as AaA;
|
|
|
|
drop view v1AA;
|
|
|
|
create view v1Aa as select AaA.col1 from t1Aa as AaA;
|
|
|
|
show create view v1AA;
|
|
|
|
drop view v1AA;
|
|
|
|
drop table t1Aa;
|
2007-11-13 10:39:52 +01:00
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Bug #31562: HAVING and lower case
|
|
|
|
#
|
|
|
|
|
|
|
|
CREATE TABLE t1 (a int, b int);
|
|
|
|
|
|
|
|
select X.a from t1 AS X group by X.b having (X.a = 1);
|
|
|
|
select X.a from t1 AS X group by X.b having (x.a = 1);
|
|
|
|
select X.a from t1 AS X group by X.b having (x.b = 1);
|
|
|
|
|
|
|
|
CREATE OR REPLACE VIEW v1 AS
|
|
|
|
select X.a from t1 AS X group by X.b having (X.a = 1);
|
|
|
|
|
|
|
|
SHOW CREATE VIEW v1;
|
|
|
|
|
|
|
|
SELECT * FROM v1;
|
|
|
|
|
|
|
|
DROP VIEW v1;
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
2010-06-25 14:59:44 +02:00
|
|
|
|
|
|
|
--echo End of 5.0 tests.
|
|
|
|
|
|
|
|
|
|
|
|
--echo #
|
|
|
|
--echo # Bug #53095: SELECT column_name FROM INFORMATION_SCHEMA.STATISTICS
|
|
|
|
--echo # returns nothing
|
|
|
|
--echo #
|
|
|
|
|
|
|
|
CREATE TABLE `ttt` (
|
|
|
|
`f1` char(3) NOT NULL,
|
|
|
|
PRIMARY KEY (`f1`)
|
|
|
|
) ENGINE=myisam DEFAULT CHARSET=latin1;
|
|
|
|
|
|
|
|
SELECT count(COLUMN_NAME) FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME =
|
|
|
|
'TTT';
|
|
|
|
SELECT count(*) FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 'TTT';
|
|
|
|
|
|
|
|
DROP TABLE `ttt`;
|
|
|
|
|
|
|
|
|
2007-11-13 10:39:52 +01:00
|
|
|
--echo End of 5.0 tests.
|