]> granicus.if.org Git - postgresql/blob - src/test/regress/expected/txid.out
Teach the system how to use hashing for UNION. (INTERSECT/EXCEPT will follow,
[postgresql] / src / test / regress / expected / txid.out
1 -- txid_snapshot data type and related functions
2 -- i/o
3 select '12:13:'::txid_snapshot;
4  txid_snapshot 
5 ---------------
6  12:13:
7 (1 row)
8
9 select '12:18:14,16'::txid_snapshot;
10  txid_snapshot 
11 ---------------
12  12:18:14,16
13 (1 row)
14
15 -- errors
16 select '31:12:'::txid_snapshot;
17 ERROR:  invalid input for txid_snapshot: "31:12:"
18 select '0:1:'::txid_snapshot;
19 ERROR:  invalid input for txid_snapshot: "0:1:"
20 select '12:13:0'::txid_snapshot;
21 ERROR:  invalid input for txid_snapshot: "12:13:0"
22 select '12:16:14,13'::txid_snapshot;
23 ERROR:  invalid input for txid_snapshot: "12:16:14,13"
24 select '12:16:14,14'::txid_snapshot;
25 ERROR:  invalid input for txid_snapshot: "12:16:14,14"
26 create temp table snapshot_test (
27         nr      integer,
28         snap    txid_snapshot
29 );
30 insert into snapshot_test values (1, '12:13:');
31 insert into snapshot_test values (2, '12:20:13,15,18');
32 insert into snapshot_test values (3, '100001:100009:100005,100007,100008');
33 insert into snapshot_test values (4, '100:150:101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131');
34 select snap from snapshot_test order by nr;
35                                                                 snap                                                                 
36 -------------------------------------------------------------------------------------------------------------------------------------
37  12:13:
38  12:20:13,15,18
39  100001:100009:100005,100007,100008
40  100:150:101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131
41 (4 rows)
42
43 select  txid_snapshot_xmin(snap),
44         txid_snapshot_xmax(snap),
45         txid_snapshot_xip(snap)
46 from snapshot_test order by nr;
47  txid_snapshot_xmin | txid_snapshot_xmax | txid_snapshot_xip 
48 --------------------+--------------------+-------------------
49                  12 |                 20 |                13
50                  12 |                 20 |                15
51                  12 |                 20 |                18
52              100001 |             100009 |            100005
53              100001 |             100009 |            100007
54              100001 |             100009 |            100008
55                 100 |                150 |               101
56                 100 |                150 |               102
57                 100 |                150 |               103
58                 100 |                150 |               104
59                 100 |                150 |               105
60                 100 |                150 |               106
61                 100 |                150 |               107
62                 100 |                150 |               108
63                 100 |                150 |               109
64                 100 |                150 |               110
65                 100 |                150 |               111
66                 100 |                150 |               112
67                 100 |                150 |               113
68                 100 |                150 |               114
69                 100 |                150 |               115
70                 100 |                150 |               116
71                 100 |                150 |               117
72                 100 |                150 |               118
73                 100 |                150 |               119
74                 100 |                150 |               120
75                 100 |                150 |               121
76                 100 |                150 |               122
77                 100 |                150 |               123
78                 100 |                150 |               124
79                 100 |                150 |               125
80                 100 |                150 |               126
81                 100 |                150 |               127
82                 100 |                150 |               128
83                 100 |                150 |               129
84                 100 |                150 |               130
85                 100 |                150 |               131
86 (37 rows)
87
88 select id, txid_visible_in_snapshot(id, snap)
89 from snapshot_test, generate_series(11, 21) id
90 where nr = 2;
91  id | txid_visible_in_snapshot 
92 ----+--------------------------
93  11 | t
94  12 | t
95  13 | f
96  14 | t
97  15 | f
98  16 | t
99  17 | t
100  18 | f
101  19 | t
102  20 | f
103  21 | f
104 (11 rows)
105
106 -- test bsearch
107 select id, txid_visible_in_snapshot(id, snap)
108 from snapshot_test, generate_series(90, 160) id
109 where nr = 4;
110  id  | txid_visible_in_snapshot 
111 -----+--------------------------
112   90 | t
113   91 | t
114   92 | t
115   93 | t
116   94 | t
117   95 | t
118   96 | t
119   97 | t
120   98 | t
121   99 | t
122  100 | t
123  101 | f
124  102 | f
125  103 | f
126  104 | f
127  105 | f
128  106 | f
129  107 | f
130  108 | f
131  109 | f
132  110 | f
133  111 | f
134  112 | f
135  113 | f
136  114 | f
137  115 | f
138  116 | f
139  117 | f
140  118 | f
141  119 | f
142  120 | f
143  121 | f
144  122 | f
145  123 | f
146  124 | f
147  125 | f
148  126 | f
149  127 | f
150  128 | f
151  129 | f
152  130 | f
153  131 | f
154  132 | t
155  133 | t
156  134 | t
157  135 | t
158  136 | t
159  137 | t
160  138 | t
161  139 | t
162  140 | t
163  141 | t
164  142 | t
165  143 | t
166  144 | t
167  145 | t
168  146 | t
169  147 | t
170  148 | t
171  149 | t
172  150 | f
173  151 | f
174  152 | f
175  153 | f
176  154 | f
177  155 | f
178  156 | f
179  157 | f
180  158 | f
181  159 | f
182  160 | f
183 (71 rows)
184
185 -- test current values also
186 select txid_current() >= txid_snapshot_xmin(txid_current_snapshot());
187  ?column? 
188 ----------
189  t
190 (1 row)
191
192 -- we can't assume current is always less than xmax, however
193 select txid_visible_in_snapshot(txid_current(), txid_current_snapshot());
194  txid_visible_in_snapshot 
195 --------------------------
196  f
197 (1 row)
198
199 -- test 64bitness
200 select txid_snapshot '1000100010001000:1000100010001100:1000100010001012,1000100010001013';
201                             txid_snapshot                            
202 ---------------------------------------------------------------------
203  1000100010001000:1000100010001100:1000100010001012,1000100010001013
204 (1 row)
205
206 select txid_visible_in_snapshot('1000100010001012', '1000100010001000:1000100010001100:1000100010001012,1000100010001013');
207  txid_visible_in_snapshot 
208 --------------------------
209  f
210 (1 row)
211
212 select txid_visible_in_snapshot('1000100010001015', '1000100010001000:1000100010001100:1000100010001012,1000100010001013');
213  txid_visible_in_snapshot 
214 --------------------------
215  t
216 (1 row)
217
218 -- test 64bit overflow
219 SELECT txid_snapshot '1:9223372036854775807:3';
220       txid_snapshot      
221 -------------------------
222  1:9223372036854775807:3
223 (1 row)
224
225 SELECT txid_snapshot '1:9223372036854775808:3';
226 ERROR:  invalid input for txid_snapshot: "1:9223372036854775808:3"