Исходный код СУБД 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
--
-- This test checks that lookup_type_cache() can correctly handle an
-- interruption.  We use the injection point to simulate an error but note
-- that a similar situation could happen due to user query interruption.
-- Despite the interruption, a map entry from the relation oid to type cache
-- entry should be created.  This is validated by subsequent modification of
-- the table schema, then type casts which use new schema implying
-- successful type cache invalidation by relation oid.
--
CREATE EXTENSION injection_points;
-- Make all injection points local to this process, for concurrency.
SELECT injection_points_set_local();
 injection_points_set_local 
----------------------------
 
(1 row)
 
CREATE TABLE t (i int);
SELECT injection_points_attach('typecache-before-rel-type-cache-insert', 'error');
 injection_points_attach 
-------------------------
 
(1 row)
 
SELECT '(1)'::t;
ERROR:  error triggered for injection point typecache-before-rel-type-cache-insert
LINE 1: SELECT '(1)'::t;
               ^
SELECT injection_points_detach('typecache-before-rel-type-cache-insert');
 injection_points_detach 
-------------------------
 
(1 row)
 
ALTER TABLE t ADD COLUMN j int;
SELECT '(1,2)'::t;
   t   
-------
 (1,2)
(1 row)
 
DROP EXTENSION injection_points;