1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
|
# name: test/sql/storage/catalog/test_view_storage.test
# description: Create and drop a view over different runs
# group: [catalog]
# FIXME: for this to work we need to serialize/deserialize dependencies
require skip_reload
# load the DB from disk
load __TEST_DIR__/view_storage.db
statement ok
set enable_view_dependencies=true
# create a schema and view
statement ok
CREATE SCHEMA test;
statement ok
CREATE TABLE test.t (a INTEGER, b INTEGER);
statement ok
CREATE VIEW test.v AS SELECT * FROM test.t;
# read the info from the view
query IIIIII
PRAGMA table_info('test.v')
----
0 a INTEGER 0 NULL 0
1 b INTEGER 0 NULL 0
# drop the table the view is based on
statement ok
DROP TABLE test.t CASCADE;
statement error
PRAGMA table_info('test.v')
----
# but querying the view fails
statement error
SELECT * FROM test.v
----
loop i 0 2
# restart the system
restart
statement error
PRAGMA table_info('test.v')
----
statement error
SELECT * FROM test.v
----
# after recreating the table, we can query the view again
statement ok
CREATE TABLE test.t (a INTEGER, b INTEGER);
statement ok
SELECT * FROM test.t
statement error
SELECT * FROM test.v
----
statement ok
CREATE VIEW test.v AS SELECT * FROM test.t;
statement ok
SELECT * FROM test.v
query IIIIII
PRAGMA table_info('test.v')
----
0 a INTEGER 0 NULL 0
1 b INTEGER 0 NULL 0
# drop the table again
statement ok
DROP TABLE test.t CASCADE;
endloop
|