Update of /cvsroot/monetdb/sql/src/test/DropCascade/Tests
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv32632/Tests

Added Files:
        All drop_columns_cascade.sql drop_function_cascade.sql 
        drop_pkey_cascade.sql drop_table_cascade.sql 
        drop_view_cascade.sql 
Log Message:
Tests do test the DROP CASCADE (more bugs for me to fix :( )



--- NEW FILE: All ---
drop_columns_cascade
drop_function_cascade
drop_pkey_cascade
drop_table_cascade
drop_view_cascade

--- NEW FILE: drop_view_cascade.sql ---
create table t1 (id int, name varchar(1024), age int);

create view v1 as select * from t1;

CREATE FUNCTION f1(num int)
RETURNS int
BEGIN 
        IF num >0
                THEN RETURN 1;
                ELSE RETURN 0;
        END IF;
END;

CREATE FUNCTION f2()
RETURNS TABLE(id int)
BEGIN
        DECLARE TABLE f1_t1(id int);
        DECLARE x int;
        
        SET x = 3;      

        IF f1(x) > 0
                THEN RETURN f1_t1;
        END IF;

        INSERT INTO f1_t1 VALUES(1);

        IF f1(x) < 0
                THEN RETURN f1_t1;
        END IF;

        RETURN TABLE (SELECT t1.id FROM v1, t1 WHERE v1.age > 10 AND t1.name 
LIKE 'monet');
END;

CREATE VIEW v2 as select * from v1;

drop view v1 cascade;


select * from tables where name = 'v1';
select * from tables where name = 'v2';
select * from functions where name = 'f2';

select * from dependencies;

--- NEW FILE: drop_table_cascade.sql ---
create table t1 (id int, name varchar(1024), age int, PRIMARY KEY(id));

create table t2 (id int, age int, PRIMARY KEY (ID), FOREIGN KEY(id) REFERENCES 
t1(id));

create trigger test1 after insert on t1
        insert into t1 values(0, 'after', 23);

create view v1 as select * from t1;

CREATE FUNCTION f1(num int)
RETURNS int
BEGIN 
        IF num >0
                THEN RETURN 1;
                ELSE RETURN 0;
        END IF;
END;

CREATE FUNCTION f2()
RETURNS TABLE(id int)
BEGIN
        DECLARE TABLE f1_t1(id int);
        DECLARE x int;
        
        SET x = 3;      

        IF f1(x) > 0
                THEN RETURN f1_t1;
        END IF;

        INSERT INTO f1_t1 VALUES(1);

        IF f1(x) < 0
                THEN RETURN f1_t1;
        END IF;

        RETURN TABLE (SELECT t1.id FROM v1, t1 WHERE v1.age > 10 AND t1.name 
LIKE 'monet');
END;

CREATE INDEX id_index ON t1(id);

DROP TABLE t1 CASCADE;

select * from tables where name = 't1';
select * from tables where name = 't2';
select * from tables where name = 'v1';
select * from triggers where name = 'test1';
select * from functions where name = 'f2';
select * from idxs where name = 'id_index';

select * from dependencies;


--- NEW FILE: drop_columns_cascade.sql ---
create table t1 (id int, name varchar(1024), age int, PRIMARY KEY(id));

create table t2 (id int, age int, PRIMARY KEY (ID), FOREIGN KEY(id) REFERENCES 
t1(id));

create view v1 as select * from t1;

create trigger test1 after insert on t1
        insert into t1 values(0, 'after', 23);

CREATE FUNCTION f1(num int)
RETURNS int
BEGIN 
        IF num >0
                THEN RETURN 1;
                ELSE RETURN 0;
        END IF;
END;

CREATE FUNCTION f2()
RETURNS TABLE(id int)
BEGIN
        DECLARE TABLE f1_t1(id int);
        DECLARE x int;
        
        SET x = 3;      

        IF f1(x) > 0
                THEN RETURN f1_t1;
        END IF;

        INSERT INTO f1_t1 VALUES(1);

        IF f1(x) < 0
                THEN RETURN f1_t1;
        END IF;

        RETURN TABLE (SELECT t1.id FROM v1, t1 WHERE v1.age > 10 AND t1.name 
LIKE 'monet');
END;

CREATE INDEX id_index ON t1(id);

ALTER TABLE t1 DROP COLUMN id CASCADE;

select * from tables where name = 't1';
select * from tables where name = 't2';
select * from tables where name = 'v1';
select * from functions where name = 'f2';
select * from triggers where name = 'test1';
select * from idxs where name = 'id_index';

select * from dependencies;


--- NEW FILE: drop_pkey_cascade.sql ---
create table t1 (id int, name varchar(1024), PRIMARY KEY(id));

create table t2 (id int, age int, PRIMARY KEY (ID), FOREIGN KEY(id) REFERENCES 
t1(id));


ALTER TABLE t1 DROP CONSTRAINT t1_id_pkey;

select * from tables where name = 't1';
select * from tables where name = 't2';
select * from keys where name = 't1_id_pkey';

select * from dependencies;


--- NEW FILE: drop_function_cascade.sql ---
create table t1 (id int, name varchar(1024), age int, PRIMARY KEY(id));

CREATE VIEW v1 as select * from t1;

CREATE FUNCTION f1(num int)
RETURNS int
BEGIN 
        IF num >0
                THEN RETURN 1;
                ELSE RETURN 0;
        END IF;
END;

CREATE FUNCTION f2()
RETURNS TABLE(id int)
BEGIN
        DECLARE TABLE f1_t1(id int);
        DECLARE x int;
        
        SET x = 3;      

        IF f1(x) > 0
                THEN RETURN f1_t1;
        END IF;

        INSERT INTO f1_t1 VALUES(1);

        IF f1(x) < 0
                THEN RETURN f1_t1;
        END IF;

        RETURN TABLE (SELECT t1.id FROM v1, t1 WHERE v1.age > 10 AND t1.name 
LIKE 'monet');
END;

DROP FUNCTION f1 CASCADE;

select * from tables where name = 't1';
select * from tables where name = 'v1';
select * from functions where name = 'f1';
select * from functions where name = 'f2';

select * from dependencies;


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins

Reply via email to