github.com/matrixorigin/matrixone@v1.2.0/test/distributed/cases/view/alterview.sql (about) 1 drop database if exists db; 2 create database db; 3 use db; 4 5 CREATE TABLE t(f1 INTEGER); 6 insert into t values(1),(2),(3),(6); 7 CREATE VIEW v AS SELECT f1 FROM t; 8 select f1 from v; 9 10 -- direct recursive reference 11 ALTER VIEW v AS SELECT f1 FROM (SELECT f1 FROM v) AS dt1 NATURAL JOIN v dt2 WHERE f1 > 5; 12 13 -- indirect recursive reference 14 create view v2 as select f1 from v; 15 select f1 from v2; 16 ALTER VIEW v AS SELECT f1 FROM (SELECT f1 FROM v2) AS dt1 NATURAL JOIN v2 dt2 WHERE f1 > 5; 17 18 drop database if exists db2; 19 create database db2; 20 use db2; 21 22 create view v3 as select f1 from db.v; 23 select f1 from v3; 24 25 use db; 26 ALTER VIEW v AS SELECT f1 FROM (SELECT f1 FROM db2.v3) AS dt1 NATURAL JOIN db2.v3 dt2 WHERE f1 > 5; 27 28 select * from vx; 29 30 alter view v as select f1 from t; 31 select * from v; 32 33 drop database if exists db; 34 drop database if exists db2;