Skip to content

Commit

Permalink
revert changes to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Tishj committed Oct 23, 2023
1 parent d737bae commit eab4c52
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 52 deletions.
6 changes: 2 additions & 4 deletions test/sql/catalog/function/test_macro_default_arg.test
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,8 @@ select my_macro2(can_not_be_empty)
----
5

statement error
drop table integers
----
Cannot drop entry "integers" because there are entries that depend on it
statement ok
drop table integers;

# The macro still exists, but points to a non existant table
statement error
Expand Down
16 changes: 4 additions & 12 deletions test/sql/catalog/view/test_view_schema_change.test
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,8 @@ SELECT * FROM v1
43

# now drop the table and create a table that has a different schema
statement error
DROP TABLE t1
----
Dependency Error: Cannot drop entry "t1" because there are entries that depend on it.

statement ok
DROP TABLE t1 CASCADE;
DROP TABLE t1

statement ok
CREATE TABLE t1(i DATE)
Expand All @@ -57,22 +52,19 @@ DROP TABLE t1
statement ok
CREATE TABLE t1(k INTEGER)

# v1 was deleted earlier as part of CASCADE
statement error
# this is fine: types still match, and the original names will be applied as alias!
query I
SELECT i FROM v1
----
Catalog Error: Table with name v1 does not exist!

statement ok
DROP TABLE t1

statement ok
CREATE TABLE t1(i INTEGER)

statement ok
CREATE VIEW v1 AS SELECT * FROM t1

# now we can query again!
query I
SELECT * FROM v1
----

20 changes: 10 additions & 10 deletions test/sql/storage/wal/wal_view_explicit_aliases.test
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,12 @@ statement ok
SELECT * FROM test.v

statement ok
DROP TABLE test.t CASCADE;
DROP TABLE test.t

# we can still query this after the table is gone
query II nosort view_info
PRAGMA table_info('test.v')
----

loop i 0 2

Expand All @@ -45,29 +50,24 @@ statement ok
PRAGMA disable_checkpoint_on_shutdown

# can check info, but not query the view
statement error
query II nosort view_info
PRAGMA table_info('test.v')
----
Catalog Error: Table with name v does not exist!

statement error
SELECT * FROM test.v

# we can query again after recreating the table
statement ok
CREATE TABLE test.t (a INTEGER, b INTEGER);

statement ok
SELECT * FROM test.t

# we need to recreate the view to query 'v' after recreating the table

statement error
SELECT b,c FROM test.v

statement ok
CREATE VIEW test.v (b,c) AS SELECT * FROM test.t;
SELECT b,c FROM test.v

statement ok
DROP TABLE test.t CASCADE;
DROP TABLE test.t

endloop
47 changes: 21 additions & 26 deletions test/sql/storage/wal/wal_view_storage.test
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,20 @@ PRAGMA table_info('test.v')
0 a INTEGER 0 NULL 0
1 b INTEGER 0 NULL 0

# try to drop the table the view is based on
statement error
DROP TABLE test.t;
# drop the table the view is based on
statement ok
DROP TABLE test.t

# we can still query the types and column names
query IIIIII
PRAGMA table_info('test.v')
----
Dependency Error: Cannot drop entry "t" because there are entries that depend on it
0 a INTEGER 0 NULL 0
1 b INTEGER 0 NULL 0

# drop the table + view
statement ok
DROP TABLE test.t CASCADE;
# but querying the view fails
statement error
SELECT * FROM test.v

statement ok
CREATE VIEW test.v2 AS SELECT 42
Expand All @@ -52,11 +57,13 @@ loop i 0 2
# restart the system
restart

# the view no longer exists
statement error
# the view still exists, but the table does not
# we can check the types, but not query it
query IIIIII
PRAGMA table_info('test.v')
----
Catalog Error: Table with name v does not exist!
0 a INTEGER 0 NULL 0
1 b INTEGER 0 NULL 0

statement error
SELECT * FROM test.v
Expand All @@ -68,14 +75,8 @@ CREATE TABLE test.t (a INTEGER, b INTEGER);
statement ok
SELECT * FROM test.t

# We created the table, but the view still doesn't exist
statement error
SELECT * FROM test.v
----
Catalog Error: Table with name v does not exist!

statement ok
CREATE VIEW test.v AS SELECT * FROM test.t;
SELECT * FROM test.v

query IIIIII
PRAGMA table_info('test.v')
Expand All @@ -84,16 +85,10 @@ PRAGMA table_info('test.v')
1 b INTEGER 0 NULL 0

# drop the table again
statement error
DROP TABLE test.t
----
Dependency Error: Cannot drop entry "t" because there are entries that depend on it

# Once we delete the dependent view, we can delete t without CASCADE
statement ok
DROP VIEW test.v;
DROP TABLE test.t

statement ok
DROP TABLE test.t;
statement error
SELECT * FROM test.v2

endloop

0 comments on commit eab4c52

Please sign in to comment.