]> granicus.if.org Git - postgresql/blob - src/test/regress/expected/txid.out
Don't allow logging in with empty password.
[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 select '12:16:14,14'::txid_snapshot;
16  txid_snapshot 
17 ---------------
18  12:16:14
19 (1 row)
20
21 -- errors
22 select '31:12:'::txid_snapshot;
23 ERROR:  invalid input syntax for type txid_snapshot: "31:12:"
24 LINE 1: select '31:12:'::txid_snapshot;
25                ^
26 select '0:1:'::txid_snapshot;
27 ERROR:  invalid input syntax for type txid_snapshot: "0:1:"
28 LINE 1: select '0:1:'::txid_snapshot;
29                ^
30 select '12:13:0'::txid_snapshot;
31 ERROR:  invalid input syntax for type txid_snapshot: "12:13:0"
32 LINE 1: select '12:13:0'::txid_snapshot;
33                ^
34 select '12:16:14,13'::txid_snapshot;
35 ERROR:  invalid input syntax for type txid_snapshot: "12:16:14,13"
36 LINE 1: select '12:16:14,13'::txid_snapshot;
37                ^
38 create temp table snapshot_test (
39         nr      integer,
40         snap    txid_snapshot
41 );
42 insert into snapshot_test values (1, '12:13:');
43 insert into snapshot_test values (2, '12:20:13,15,18');
44 insert into snapshot_test values (3, '100001:100009:100005,100007,100008');
45 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');
46 select snap from snapshot_test order by nr;
47                                                                 snap                                                                 
48 -------------------------------------------------------------------------------------------------------------------------------------
49  12:13:
50  12:20:13,15,18
51  100001:100009:100005,100007,100008
52  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
53 (4 rows)
54
55 select  txid_snapshot_xmin(snap),
56         txid_snapshot_xmax(snap),
57         txid_snapshot_xip(snap)
58 from snapshot_test order by nr;
59  txid_snapshot_xmin | txid_snapshot_xmax | txid_snapshot_xip 
60 --------------------+--------------------+-------------------
61                  12 |                 20 |                13
62                  12 |                 20 |                15
63                  12 |                 20 |                18
64              100001 |             100009 |            100005
65              100001 |             100009 |            100007
66              100001 |             100009 |            100008
67                 100 |                150 |               101
68                 100 |                150 |               102
69                 100 |                150 |               103
70                 100 |                150 |               104
71                 100 |                150 |               105
72                 100 |                150 |               106
73                 100 |                150 |               107
74                 100 |                150 |               108
75                 100 |                150 |               109
76                 100 |                150 |               110
77                 100 |                150 |               111
78                 100 |                150 |               112
79                 100 |                150 |               113
80                 100 |                150 |               114
81                 100 |                150 |               115
82                 100 |                150 |               116
83                 100 |                150 |               117
84                 100 |                150 |               118
85                 100 |                150 |               119
86                 100 |                150 |               120
87                 100 |                150 |               121
88                 100 |                150 |               122
89                 100 |                150 |               123
90                 100 |                150 |               124
91                 100 |                150 |               125
92                 100 |                150 |               126
93                 100 |                150 |               127
94                 100 |                150 |               128
95                 100 |                150 |               129
96                 100 |                150 |               130
97                 100 |                150 |               131
98 (37 rows)
99
100 select id, txid_visible_in_snapshot(id, snap)
101 from snapshot_test, generate_series(11, 21) id
102 where nr = 2;
103  id | txid_visible_in_snapshot 
104 ----+--------------------------
105  11 | t
106  12 | t
107  13 | f
108  14 | t
109  15 | f
110  16 | t
111  17 | t
112  18 | f
113  19 | t
114  20 | f
115  21 | f
116 (11 rows)
117
118 -- test bsearch
119 select id, txid_visible_in_snapshot(id, snap)
120 from snapshot_test, generate_series(90, 160) id
121 where nr = 4;
122  id  | txid_visible_in_snapshot 
123 -----+--------------------------
124   90 | t
125   91 | t
126   92 | t
127   93 | t
128   94 | t
129   95 | t
130   96 | t
131   97 | t
132   98 | t
133   99 | t
134  100 | t
135  101 | f
136  102 | f
137  103 | f
138  104 | f
139  105 | f
140  106 | f
141  107 | f
142  108 | f
143  109 | f
144  110 | f
145  111 | f
146  112 | f
147  113 | f
148  114 | f
149  115 | f
150  116 | f
151  117 | f
152  118 | f
153  119 | f
154  120 | f
155  121 | f
156  122 | f
157  123 | f
158  124 | f
159  125 | f
160  126 | f
161  127 | f
162  128 | f
163  129 | f
164  130 | f
165  131 | f
166  132 | t
167  133 | t
168  134 | t
169  135 | t
170  136 | t
171  137 | t
172  138 | t
173  139 | t
174  140 | t
175  141 | t
176  142 | t
177  143 | t
178  144 | t
179  145 | t
180  146 | t
181  147 | t
182  148 | t
183  149 | t
184  150 | f
185  151 | f
186  152 | f
187  153 | f
188  154 | f
189  155 | f
190  156 | f
191  157 | f
192  158 | f
193  159 | f
194  160 | f
195 (71 rows)
196
197 -- test current values also
198 select txid_current() >= txid_snapshot_xmin(txid_current_snapshot());
199  ?column? 
200 ----------
201  t
202 (1 row)
203
204 -- we can't assume current is always less than xmax, however
205 select txid_visible_in_snapshot(txid_current(), txid_current_snapshot());
206  txid_visible_in_snapshot 
207 --------------------------
208  f
209 (1 row)
210
211 -- test 64bitness
212 select txid_snapshot '1000100010001000:1000100010001100:1000100010001012,1000100010001013';
213                             txid_snapshot                            
214 ---------------------------------------------------------------------
215  1000100010001000:1000100010001100:1000100010001012,1000100010001013
216 (1 row)
217
218 select txid_visible_in_snapshot('1000100010001012', '1000100010001000:1000100010001100:1000100010001012,1000100010001013');
219  txid_visible_in_snapshot 
220 --------------------------
221  f
222 (1 row)
223
224 select txid_visible_in_snapshot('1000100010001015', '1000100010001000:1000100010001100:1000100010001012,1000100010001013');
225  txid_visible_in_snapshot 
226 --------------------------
227  t
228 (1 row)
229
230 -- test 64bit overflow
231 SELECT txid_snapshot '1:9223372036854775807:3';
232       txid_snapshot      
233 -------------------------
234  1:9223372036854775807:3
235 (1 row)
236
237 SELECT txid_snapshot '1:9223372036854775808:3';
238 ERROR:  invalid input syntax for type txid_snapshot: "1:9223372036854775808:3"
239 LINE 1: SELECT txid_snapshot '1:9223372036854775808:3';
240                              ^
241 -- test txid_current_if_assigned
242 BEGIN;
243 SELECT txid_current_if_assigned() IS NULL;
244  ?column? 
245 ----------
246  t
247 (1 row)
248
249 SELECT txid_current() \gset
250 SELECT txid_current_if_assigned() IS NOT DISTINCT FROM BIGINT :'txid_current';
251  ?column? 
252 ----------
253  t
254 (1 row)
255
256 COMMIT;
257 -- test xid status functions
258 BEGIN;
259 SELECT txid_current() AS committed \gset
260 COMMIT;
261 BEGIN;
262 SELECT txid_current() AS rolledback \gset
263 ROLLBACK;
264 BEGIN;
265 SELECT txid_current() AS inprogress \gset
266 SELECT txid_status(:committed) AS committed;
267  committed 
268 -----------
269  committed
270 (1 row)
271
272 SELECT txid_status(:rolledback) AS rolledback;
273  rolledback 
274 ------------
275  aborted
276 (1 row)
277
278 SELECT txid_status(:inprogress) AS inprogress;
279  inprogress  
280 -------------
281  in progress
282 (1 row)
283
284 SELECT txid_status(1); -- BootstrapTransactionId is always committed
285  txid_status 
286 -------------
287  committed
288 (1 row)
289
290 SELECT txid_status(2); -- FrozenTransactionId is always committed
291  txid_status 
292 -------------
293  committed
294 (1 row)
295
296 SELECT txid_status(3); -- in regress testing FirstNormalTransactionId will always be behind oldestXmin
297  txid_status 
298 -------------
299  
300 (1 row)
301
302 COMMIT;
303 BEGIN;
304 CREATE FUNCTION test_future_xid_status(bigint)
305 RETURNS void
306 LANGUAGE plpgsql
307 AS
308 $$
309 BEGIN
310   PERFORM txid_status($1);
311   RAISE EXCEPTION 'didn''t ERROR at xid in the future as expected';
312 EXCEPTION
313   WHEN invalid_parameter_value THEN
314     RAISE NOTICE 'Got expected error for xid in the future';
315 END;
316 $$;
317 SELECT test_future_xid_status(:inprogress + 10000);
318 NOTICE:  Got expected error for xid in the future
319  test_future_xid_status 
320 ------------------------
321  
322 (1 row)
323
324 ROLLBACK;