Description
Start a 4.x server with phoenix.allow.system.catalog.rollback=true, phoenix.system.catalog.splittable=false. Connect to it from a 4.x client with phoenix.allow.system.catalog.rollback=true. Run the following from the 4.x client:
CREATE TABLE IF NOT EXISTS T (A INTEGER PRIMARY KEY, B INTEGER, C VARCHAR, D INTEGER); CREATE VIEW IF NOT EXISTS V (VA INTEGER, VB INTEGER) AS SELECT * FROM T WHERE B=200; UPSERT INTO V(A,B,C,D,VA,VB) VALUES (2, 200, 'def', -20, 91, 101); SELECT * FROM T; +----+------+------+------+ | A | B | C | D | +----+------+------+------+ | 2 | 200 | def | -20 | +----+------+------+------+ SELECT * FROM V; +----+------+------+------+-----+------+ | A | B | C | D | VA | VB | +----+------+------+------+-----+------+ | 2 | 200 | def | -20 | 91 | 101 | +----+------+------+------+-----+------+ -- as expected -- below view can be either a tenant-specific view or a global view, as long as its parent is V. CREATE VIEW V_t001 AS SELECT * FROM V; ALTER VIEW V DROP COLUMN VA; SELECT * FROM V; +----+------+------+------+------+ | A | B | C | D | VB | +----+------+------+------+------+ | 2 | 200 | def | -20 | 101 | +----+------+------+------+------+ -- We shouldn't see VA below since it was dropped from the parent SELECT * FROM V_T001; +----+------+------+------+-----+------+ | A | B | C | D | VA | VB | +----+------+------+------+-----+------+ | 2 | 200 | def | -20 | 91 | 101 | +----+------+------+------+-----+------+
If rollback is enabled, we prevent adding/dropping a column to/from a table that has child views (see this). However, we don't prevent adding/dropping columns to/from a view that has child views (see here). Either we should also prevent column mutations in case of views that have children or make sure that dropped columns don't show up when querying a child view.