From eab4c52b43a9f3e8b6c4ee1b8723eeebc65d88b6 Mon Sep 17 00:00:00 2001 From: Tishj Date: Mon, 23 Oct 2023 14:01:44 +0200 Subject: [PATCH] revert changes to tests --- .../function/test_macro_default_arg.test | 6 +-- .../catalog/view/test_view_schema_change.test | 16 ++----- .../wal/wal_view_explicit_aliases.test | 20 ++++---- test/sql/storage/wal/wal_view_storage.test | 47 +++++++++---------- 4 files changed, 37 insertions(+), 52 deletions(-) diff --git a/test/sql/catalog/function/test_macro_default_arg.test b/test/sql/catalog/function/test_macro_default_arg.test index 9311aa5c7e96..471f2f9ab2ce 100644 --- a/test/sql/catalog/function/test_macro_default_arg.test +++ b/test/sql/catalog/function/test_macro_default_arg.test @@ -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 diff --git a/test/sql/catalog/view/test_view_schema_change.test b/test/sql/catalog/view/test_view_schema_change.test index 121e93d758f7..ba2bb4f7105d 100644 --- a/test/sql/catalog/view/test_view_schema_change.test +++ b/test/sql/catalog/view/test_view_schema_change.test @@ -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) @@ -57,11 +52,10 @@ 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 @@ -69,10 +63,8 @@ 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 ---- + diff --git a/test/sql/storage/wal/wal_view_explicit_aliases.test b/test/sql/storage/wal/wal_view_explicit_aliases.test index 8a5d0d6cb44a..e483bacb1777 100644 --- a/test/sql/storage/wal/wal_view_explicit_aliases.test +++ b/test/sql/storage/wal/wal_view_explicit_aliases.test @@ -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 @@ -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 diff --git a/test/sql/storage/wal/wal_view_storage.test b/test/sql/storage/wal/wal_view_storage.test index b1bc788bd860..bc90bd41d31d 100644 --- a/test/sql/storage/wal/wal_view_storage.test +++ b/test/sql/storage/wal/wal_view_storage.test @@ -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 @@ -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 @@ -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') @@ -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