Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
  • Loading branch information
BugenZhao committed Feb 24, 2023
1 parent 9035ef1 commit 54a92dd
Showing 1 changed file with 40 additions and 3 deletions.
43 changes: 40 additions & 3 deletions e2e_test/ddl/alter_table_column.slt
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ alter table t add column v1 int primary key;
statement error is not a table or cannot be altered
alter table mv add column v1 int;

statement ok
drop materialized view mv;

# Add column
statement ok
alter table t add column r real;

statement ok
create materialized view mv2 as select * from t;

query IR
select v, r from t;
----
Expand All @@ -33,6 +33,9 @@ public.t CREATE TABLE t (v INT, r REAL)
statement ok
alter table t add column s varchar;

statement ok
create materialized view mv3 as select * from t;

query IRT
select v, r, s from t;
----
Expand All @@ -42,5 +45,39 @@ show create table t;
----
public.t CREATE TABLE t (v INT, r REAL, s CHARACTER VARYING)

# Insert data
# TODO(#7906): alter after insert.
statement ok
insert into t values (1, 1.1, 'a');

statement ok
flush;

# All materialized views should keep the schema when it's created.
query I
select * from mv;
----
1

query IR
select * from mv2;
----
1 1.1

query IRT
select * from mv3;
----
1 1.1 a

# Drop columns
statement ok
drop materialized view mv;

statement ok
drop materialized view mv2;

statement ok
drop materialized view mv3;

statement ok
drop table t;

0 comments on commit 54a92dd

Please sign in to comment.