Added skipped test for buggy AS OF behavior in view definitions

This commit is contained in:
Zach Musgrave
2022-03-15 17:27:39 -07:00
parent e895d583a5
commit 4b997e41a8

View File

@@ -235,3 +235,46 @@ SQL
[ "$status" -eq 1 ]
[[ "${lines[0]}" =~ "table not found: five" ]] || false
}
@test "create-views: AS OF" {
dolt sql <<SQL
create table t1 (a int primary key, b int);
insert into t1 values (1,1);
select dolt_commit('-am', 'table with one row');
select dolt_branch('onerow');
insert into t1 values (2,2);
select dolt_commit('-am', 'table with two rows');
select dolt_branch('tworows');
create view v1 as select * from t1;
select dolt_commit('-am', 'view with select *');
select dolt_branch('view');
insert into t1 values (3,3);
select dolt_commit('-am', 'table with three rows');
select dolt_branch('threerows');
drop view v1;
create view v1 as select a+10, b+10 from t1;
SQL
# should show the original view definition
run dolt sql -r csv -q "select * from dolt_schemas as of 'view' order by 1"
[ "$status" -eq 0 ]
[ "${#lines[@]}" -eq 2 ]
[[ "$output" =~ "select * from t1" ]] || false
skip "View definition always come from HEAD, rather than from named commit"
# should use the data and view definition from this branch
run dolt sql -r csv -q "select * from v1 as of 'view' order by 1"
[ "$status" -eq 0 ]
[ "${#lines[@]}" -eq 3 ]
[[ "${lines[1]}" =~ "1,1" ]] || false
[[ "${lines[1]}" =~ "2,2" ]] || false
# should use the data and view definition from this branch
run dolt sql -r csv -q "select * from v1 as of 'threerows' order by 1"
[ "$status" -eq 0 ]
[ "${#lines[@]}" -eq 4 ]
[[ "${lines[1]}" =~ "1,1" ]] || false
[[ "${lines[1]}" =~ "2,2" ]] || false
[[ "${lines[1]}" =~ "3,3" ]] || false
}