65 lines
1.1 KiB
SQL
65 lines
1.1 KiB
SQL
# name: test/sql/attach/attach_serialize_dependency.test
|
|
# description: Test attach and re-attach with serialized dependencies
|
|
# group: [attach]
|
|
|
|
statement ok
|
|
set storage_compatibility_version='latest';
|
|
|
|
statement ok
|
|
attach '__TEST_DIR__/db1.db';
|
|
|
|
statement ok
|
|
use db1;
|
|
|
|
statement ok
|
|
CREATE TABLE A (A1 INTEGER PRIMARY KEY,A2 VARCHAR, A3 INTEGER);
|
|
|
|
statement ok
|
|
CREATE INDEX A_index ON A (A2);
|
|
|
|
statement ok
|
|
CREATE TABLE B(B1 INTEGER REFERENCES A(A1));
|
|
|
|
statement ok
|
|
attach '__TEST_DIR__/db1_other.db';
|
|
|
|
statement ok
|
|
USE db1_other;
|
|
|
|
statement ok
|
|
detach db1;
|
|
|
|
statement ok
|
|
attach '__TEST_DIR__/db1.db' as other_db;
|
|
|
|
# now test with a WAL
|
|
statement ok
|
|
PRAGMA disable_checkpoint_on_shutdown
|
|
|
|
statement ok
|
|
PRAGMA wal_autocheckpoint='1TB';
|
|
|
|
statement ok
|
|
attach '__TEST_DIR__/db2.db';
|
|
|
|
statement ok
|
|
use db2;
|
|
|
|
statement ok
|
|
CREATE TABLE A (A1 INTEGER PRIMARY KEY,A2 VARCHAR, A3 INTEGER);
|
|
|
|
statement ok
|
|
CREATE INDEX A_index ON A (A2);
|
|
|
|
statement ok
|
|
CREATE TABLE B(B1 INTEGER REFERENCES A(A1));
|
|
|
|
statement ok
|
|
USE db1_other;
|
|
|
|
statement ok
|
|
detach db2;
|
|
|
|
statement ok
|
|
attach '__TEST_DIR__/db2.db' as other_db2;
|