Исходный код СУБД RuDB — свободной СУБД с открытым исходным кодом на базе PostgreSQL
rudb
2 days ago bd039d1e92813358c5c5a1e346b49074baf513f2
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
-- Tests with portals set up by a Bind message.
-- All these rely on the unnamed portal with \bind.
 
CREATE EXTENSION injection_points;
 
-- Make the injection points local to this session.
SELECT injection_points_set_local();
 
-- Portal is new, not fully set up yet.
SELECT injection_points_attach('bind-portal-created', 'error');
-- No transaction block.
SELECT 1 \bind \g
SELECT 2;
-- Transaction block, not aborted after failure.
BEGIN;
SELECT 3 \bind \g
ROLLBACK;
SELECT 4;
-- Transaction block already aborted when failure happens.
BEGIN;
SELECT 1/0;
ROLLBACK \bind \g
ROLLBACK;
SELECT 5;
-- Sub-transaction already aborted when failure happens.
BEGIN;
SAVEPOINT s;
SELECT 1/0;
ROLLBACK TO s \bind \g
ROLLBACK TO s;
SELECT 6;
COMMIT;
SELECT injection_points_detach('bind-portal-created');
 
-- Portal is defined, not fully set up yet.
SELECT injection_points_attach('bind-portal-defined', 'error');
-- No transaction block.
SELECT 1 \bind \g
SELECT 2;
-- Transaction block, not aborted under failure.
BEGIN;
SELECT 3 \bind \g
ROLLBACK;
SELECT 4;
-- Transaction block already aborted when failure happens.
BEGIN;
SELECT 1/0;
ROLLBACK \bind \g
ROLLBACK;
SELECT 5;
-- Sub-transaction already aborted when failure happens.
BEGIN;
SAVEPOINT s;
SELECT 1/0;
ROLLBACK TO s \bind \g
ROLLBACK TO s;
SELECT 6;
COMMIT;
SELECT injection_points_detach('bind-portal-defined');
 
DROP EXTENSION injection_points;