File: test_index_rollback_flushed_data.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 (43 lines) | stat: -rw-r--r-- 862 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
# name: test/sql/transactions/test_index_rollback_flushed_data.test
# description: Test that we revert the global storage correctly after a constraint violation
# group: [transactions]

statement ok
PRAGMA enable_verification

statement ok con1
CREATE TABLE integers(i INTEGER UNIQUE);

statement ok con1
BEGIN TRANSACTION;

statement ok con2
BEGIN TRANSACTION;

statement ok con1
INSERT INTO integers VALUES (-10);

statement ok con2
INSERT INTO integers SELECT range FROM range(2, 4097, 1);

# constraint violation
statement ok con2
INSERT INTO integers VALUES (-10);

# con1 commits first
statement ok con1
COMMIT;

# con2 fails to commit because of the conflict
statement error con2
COMMIT;
----
PRIMARY KEY or UNIQUE constraint violation

statement ok
INSERT INTO integers SELECT i FROM range(2, 4097, 1) t1(i)

query I
SELECT MAX(i) FROM integers
----
4096