File: txid.out

package info (click to toggle)
skytools 2.1.8-2.2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 1,980 kB
  • ctags: 1,543
  • sloc: sql: 6,635; python: 6,237; ansic: 2,799; makefile: 308; sh: 268
file content (77 lines) | stat: -rw-r--r-- 2,179 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
72
73
74
75
76
77
-- init
\set ECHO none
-- i/o
select '12:13:'::txid_snapshot;
 txid_snapshot 
---------------
 12:13:
(1 row)

select '12:13:1,2'::txid_snapshot;
ERROR:  illegal txid_snapshot input format
-- errors
select '31:12:'::txid_snapshot;
ERROR:  illegal txid_snapshot input format
select '0:1:'::txid_snapshot;
ERROR:  illegal txid_snapshot input format
select '12:13:0'::txid_snapshot;
ERROR:  illegal txid_snapshot input format
select '12:13:2,1'::txid_snapshot;
ERROR:  illegal txid_snapshot input format
create table snapshot_test (
	nr	integer,
	snap	txid_snapshot
);
insert into snapshot_test values (1, '12:13:');
insert into snapshot_test values (2, '12:20:13,15,18');
insert into snapshot_test values (3, '100001:100009:100005,100007,100008');
select snap from snapshot_test order by nr;
                snap                
------------------------------------
 12:13:
 12:20:13,15,18
 100001:100009:100005,100007,100008
(3 rows)

select  txid_snapshot_xmin(snap),
	txid_snapshot_xmax(snap),
	txid_snapshot_xip(snap)
from snapshot_test order by nr;
 txid_snapshot_xmin | txid_snapshot_xmax | txid_snapshot_xip 
--------------------+--------------------+-------------------
                 12 |                 20 |                13
                 12 |                 20 |                15
                 12 |                 20 |                18
             100001 |             100009 |            100005
             100001 |             100009 |            100007
             100001 |             100009 |            100008
(6 rows)

select id, txid_visible_in_snapshot(id, snap)
from snapshot_test, generate_series(11, 21) id
where nr = 2;
 id | txid_visible_in_snapshot 
----+--------------------------
 11 | t
 12 | t
 13 | f
 14 | t
 15 | f
 16 | t
 17 | t
 18 | f
 19 | t
 20 | f
 21 | f
(11 rows)

-- test current values also
select txid_current() >= txid_snapshot_xmin(txid_current_snapshot());
 ?column? 
----------
 t
(1 row)

-- select txid_current_txid() < txid_snapshot_xmax(txid_current_snapshot());
-- select txid_in_snapshot(txid_current_txid(), txid_current_snapshot()),
--    txid_not_in_snapshot(txid_current_txid(), txid_current_snapshot());