File: wal_store_defaults.test

package info (click to toggle)
duckdb 1.5.1-2
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 299,196 kB
  • sloc: cpp: 865,414; ansic: 57,292; python: 18,871; sql: 12,663; lisp: 11,751; yacc: 7,412; lex: 1,682; sh: 747; makefile: 558
file content (71 lines) | stat: -rw-r--r-- 1,167 bytes parent folder | download | duplicates (4)
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
# name: test/sql/storage/wal/wal_store_defaults.test
# description: Test storage of default values
# group: [wal]

require skip_reload


# load the DB from disk
load __TEST_DIR__/test_store_defaults.db

statement ok
PRAGMA disable_checkpoint_on_shutdown

statement ok
PRAGMA wal_autocheckpoint='1TB';

# create a table with a default value
statement ok
CREATE TABLE test (a INTEGER DEFAULT 1, b INTEGER);

statement ok
INSERT INTO test (b) VALUES (11)

query II
SELECT * FROM test ORDER BY b
----
1	11

# reload the database
restart

statement ok
PRAGMA disable_checkpoint_on_shutdown

statement ok
PRAGMA wal_autocheckpoint='1TB';

# verify that the table contains the correct contents
query II
SELECT * FROM test ORDER BY b
----
1	11

# append more entries
statement ok
INSERT INTO test (b) VALUES (12), (13)

# check that the default value was used in the INSERT
query II
SELECT * FROM test ORDER BY b
----
1	11
1	12
1	13

# reload and append one more time
restart

# append more entries
statement ok
INSERT INTO test (b) VALUES (14), (15)

# check that the default value was used in the INSERT
query II
SELECT * FROM test ORDER BY b
----
1	11
1	12
1	13
1	14
1	15