2 -- Tests for some likely failure cases with combo cmin/cmax mechanism
4 CREATE TEMP TABLE combocidtest (foobar int);
6 -- a few dummy ops to push up the CommandId counter
7 INSERT INTO combocidtest SELECT 1 LIMIT 0;
8 INSERT INTO combocidtest SELECT 1 LIMIT 0;
9 INSERT INTO combocidtest SELECT 1 LIMIT 0;
10 INSERT INTO combocidtest SELECT 1 LIMIT 0;
11 INSERT INTO combocidtest SELECT 1 LIMIT 0;
12 INSERT INTO combocidtest SELECT 1 LIMIT 0;
13 INSERT INTO combocidtest SELECT 1 LIMIT 0;
14 INSERT INTO combocidtest SELECT 1 LIMIT 0;
15 INSERT INTO combocidtest SELECT 1 LIMIT 0;
16 INSERT INTO combocidtest SELECT 1 LIMIT 0;
17 INSERT INTO combocidtest VALUES (1);
18 INSERT INTO combocidtest VALUES (2);
19 SELECT ctid,cmin,* FROM combocidtest;
21 -------+------+--------
27 UPDATE combocidtest SET foobar = foobar + 10;
28 -- here we should see only updated tuples
29 SELECT ctid,cmin,* FROM combocidtest;
31 -------+------+--------
37 -- now we should see old tuples, but with combo CIDs starting at 0
38 SELECT ctid,cmin,* FROM combocidtest;
40 -------+------+--------
46 -- combo data is not there anymore, but should still see tuples
47 SELECT ctid,cmin,* FROM combocidtest;
49 -------+------+--------
54 -- Test combo cids with portals
56 INSERT INTO combocidtest VALUES (333);
57 DECLARE c CURSOR FOR SELECT ctid,cmin,* FROM combocidtest;
58 DELETE FROM combocidtest;
61 -------+------+--------
68 SELECT ctid,cmin,* FROM combocidtest;
70 -------+------+--------
75 -- check behavior with locked tuples
77 -- a few dummy ops to push up the CommandId counter
78 INSERT INTO combocidtest SELECT 1 LIMIT 0;
79 INSERT INTO combocidtest SELECT 1 LIMIT 0;
80 INSERT INTO combocidtest SELECT 1 LIMIT 0;
81 INSERT INTO combocidtest SELECT 1 LIMIT 0;
82 INSERT INTO combocidtest SELECT 1 LIMIT 0;
83 INSERT INTO combocidtest SELECT 1 LIMIT 0;
84 INSERT INTO combocidtest SELECT 1 LIMIT 0;
85 INSERT INTO combocidtest SELECT 1 LIMIT 0;
86 INSERT INTO combocidtest SELECT 1 LIMIT 0;
87 INSERT INTO combocidtest SELECT 1 LIMIT 0;
88 INSERT INTO combocidtest VALUES (444);
89 SELECT ctid,cmin,* FROM combocidtest;
91 -------+------+--------
98 -- this doesn't affect cmin
99 SELECT ctid,cmin,* FROM combocidtest FOR UPDATE;
101 -------+------+--------
107 SELECT ctid,cmin,* FROM combocidtest;
109 -------+------+--------
116 UPDATE combocidtest SET foobar = foobar + 10;
117 SELECT ctid,cmin,* FROM combocidtest;
119 -------+------+--------
126 SELECT ctid,cmin,* FROM combocidtest;
128 -------+------+--------
135 SELECT ctid,cmin,* FROM combocidtest;
137 -------+------+--------