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 86
|
# name: test/sql/storage/wal/wal_store_sequences.test
# description: Use sequences over different runs
# group: [wal]
load __TEST_DIR__/store_sequences.db
statement ok
PRAGMA disable_checkpoint_on_shutdown
statement ok
PRAGMA wal_autocheckpoint='1TB';
# standard sequence
statement ok
CREATE SEQUENCE seq
# more complex sequence
statement ok
CREATE SEQUENCE seq_cycle INCREMENT 1 MAXVALUE 3 START 2 CYCLE;
query I
SELECT nextval('seq')
----
1
query I
SELECT nextval('seq_cycle')
----
2
statement ok
CREATE SEQUENCE seq2
statement ok
DROP SEQUENCE seq2
# restart and check that sequence still works
restart
statement ok
PRAGMA disable_checkpoint_on_shutdown
statement ok
PRAGMA wal_autocheckpoint='1TB';
query I
SELECT nextval('seq')
----
2
query I
SELECT nextval('seq_cycle')
----
3
statement error
SELECT nextval('seq2')
----
# again
restart
query II
SELECT nextval('seq'), nextval('seq')
----
3 4
query I
SELECT nextval('seq_cycle')
----
1
# drop sequence
statement ok
DROP SEQUENCE seq;
restart
# verify that sequence is gone
statement error
SELECT nextval('seq')
----
# other sequence is still there
statement ok
SELECT nextval('seq_cycle')
|