Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit ebe5122

Browse files
author
Potapov Alexander
committedFeb 18, 2025·
PGPRO-11987 Support new Optimizer's behaviour in regression tests
1 parent b6e5430 commit ebe5122

30 files changed

+4012
-136
lines changed
 

‎expected/altorder.out

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*
66
* altorder.out - test output for 64-bit systems and
77
* altorder_1.out - test output for 32-bit systems.
8+
* altorder_3.out - test output for 32-bit systems (Rel 18).
89
*
910
*/
1011
CREATE TABLE atsts (id int, t tsvector, d timestamp);

‎expected/altorder_1.out

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*
66
* altorder.out - test output for 64-bit systems and
77
* altorder_1.out - test output for 32-bit systems.
8+
* altorder_3.out - test output for 32-bit systems (Rel 18).
89
*
910
*/
1011
CREATE TABLE atsts (id int, t tsvector, d timestamp);

‎expected/altorder_3.out

Lines changed: 594 additions & 0 deletions
Large diffs are not rendered by default.

‎expected/altorder_hash.out

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*
66
* altorder_hash.out - test output for 64-bit systems and
77
* altorder_hash_1.out - test output for 32-bit systems.
8+
* altorder_hash_3.out - test output for 32-bit systems (Rel 18).
89
*
910
*/
1011
CREATE TABLE atstsh (id int, t tsvector, d timestamp);

‎expected/altorder_hash_1.out

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*
66
* altorder_hash.out - test output for 64-bit systems and
77
* altorder_hash_1.out - test output for 32-bit systems.
8+
* altorder_hash_3.out - test output for 32-bit systems (Rel 18).
89
*
910
*/
1011
CREATE TABLE atstsh (id int, t tsvector, d timestamp);

‎expected/altorder_hash_3.out

Lines changed: 359 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,359 @@
1+
/*
2+
* ------------------------------------
3+
* NOTE: This test behaves differenly
4+
* ------------------------------------
5+
*
6+
* altorder_hash.out - test output for 64-bit systems and
7+
* altorder_hash_1.out - test output for 32-bit systems.
8+
* altorder_hash_3.out - test output for 32-bit systems (Rel 18).
9+
*
10+
*/
11+
CREATE TABLE atstsh (id int, t tsvector, d timestamp);
12+
\copy atstsh from 'data/tsts.data'
13+
CREATE INDEX atstsh_idx ON atstsh USING rum (t rum_tsvector_hash_addon_ops, d)
14+
WITH (attach = 'd', to = 't', order_by_attach='t');
15+
ERROR: doesn't support order index over pass-by-reference column
16+
INSERT INTO atstsh VALUES (-1, 't1 t2', '2016-05-02 02:24:22.326724');
17+
INSERT INTO atstsh VALUES (-2, 't1 t2 t3', '2016-05-02 02:26:22.326724');
18+
SELECT count(*) FROM atstsh WHERE t @@ 'wr|qh';
19+
count
20+
-------
21+
158
22+
(1 row)
23+
24+
SELECT count(*) FROM atstsh WHERE t @@ 'wr&qh';
25+
count
26+
-------
27+
17
28+
(1 row)
29+
30+
SELECT count(*) FROM atstsh WHERE t @@ 'eq&yt';
31+
count
32+
-------
33+
6
34+
(1 row)
35+
36+
SELECT count(*) FROM atstsh WHERE t @@ 'eq|yt';
37+
count
38+
-------
39+
98
40+
(1 row)
41+
42+
SELECT count(*) FROM atstsh WHERE t @@ '(eq&yt)|(wr&qh)';
43+
count
44+
-------
45+
23
46+
(1 row)
47+
48+
SELECT count(*) FROM atstsh WHERE t @@ '(eq|yt)&(wr|qh)';
49+
count
50+
-------
51+
39
52+
(1 row)
53+
54+
SET enable_indexscan=OFF;
55+
SET enable_indexonlyscan=OFF;
56+
SET enable_bitmapscan=OFF;
57+
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM atstsh WHERE t @@ 'wr&qh' ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
58+
id | d | ?column?
59+
-----+---------------------------------+---------------
60+
355 | Mon May 16 14:21:22.326724 2016 | 2.673276
61+
354 | Mon May 16 13:21:22.326724 2016 | 3602.673276
62+
371 | Tue May 17 06:21:22.326724 2016 | 57597.326724
63+
406 | Wed May 18 17:21:22.326724 2016 | 183597.326724
64+
415 | Thu May 19 02:21:22.326724 2016 | 215997.326724
65+
(5 rows)
66+
67+
SELECT id, d, d <=| '2016-05-16 14:21:25' FROM atstsh WHERE t @@ 'wr&qh' ORDER BY d <=| '2016-05-16 14:21:25' LIMIT 5;
68+
id | d | ?column?
69+
-----+---------------------------------+---------------
70+
355 | Mon May 16 14:21:22.326724 2016 | 2.673276
71+
354 | Mon May 16 13:21:22.326724 2016 | 3602.673276
72+
252 | Thu May 12 07:21:22.326724 2016 | 370802.673276
73+
232 | Wed May 11 11:21:22.326724 2016 | 442802.673276
74+
168 | Sun May 08 19:21:22.326724 2016 | 673202.673276
75+
(5 rows)
76+
77+
SELECT id, d, d |=> '2016-05-16 14:21:25' FROM atstsh WHERE t @@ 'wr&qh' ORDER BY d |=> '2016-05-16 14:21:25' LIMIT 5;
78+
id | d | ?column?
79+
-----+---------------------------------+---------------
80+
371 | Tue May 17 06:21:22.326724 2016 | 57597.326724
81+
406 | Wed May 18 17:21:22.326724 2016 | 183597.326724
82+
415 | Thu May 19 02:21:22.326724 2016 | 215997.326724
83+
428 | Thu May 19 15:21:22.326724 2016 | 262797.326724
84+
457 | Fri May 20 20:21:22.326724 2016 | 367197.326724
85+
(5 rows)
86+
87+
SELECT count(*) FROM atstsh WHERE d < '2016-05-16 14:21:25';
88+
count
89+
-------
90+
357
91+
(1 row)
92+
93+
SELECT count(*) FROM atstsh WHERE d > '2016-05-16 14:21:25';
94+
count
95+
-------
96+
153
97+
(1 row)
98+
99+
SELECT id, d FROM atstsh WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER BY d;
100+
id | d
101+
-----+---------------------------------
102+
16 | Mon May 02 11:21:22.326724 2016
103+
39 | Tue May 03 10:21:22.326724 2016
104+
71 | Wed May 04 18:21:22.326724 2016
105+
135 | Sat May 07 10:21:22.326724 2016
106+
168 | Sun May 08 19:21:22.326724 2016
107+
232 | Wed May 11 11:21:22.326724 2016
108+
252 | Thu May 12 07:21:22.326724 2016
109+
354 | Mon May 16 13:21:22.326724 2016
110+
355 | Mon May 16 14:21:22.326724 2016
111+
(9 rows)
112+
113+
SELECT id, d FROM atstsh WHERE t @@ 'wr&qh' AND d >= '2016-05-16 14:21:25' ORDER BY d;
114+
id | d
115+
-----+---------------------------------
116+
371 | Tue May 17 06:21:22.326724 2016
117+
406 | Wed May 18 17:21:22.326724 2016
118+
415 | Thu May 19 02:21:22.326724 2016
119+
428 | Thu May 19 15:21:22.326724 2016
120+
457 | Fri May 20 20:21:22.326724 2016
121+
458 | Fri May 20 21:21:22.326724 2016
122+
484 | Sat May 21 23:21:22.326724 2016
123+
496 | Sun May 22 11:21:22.326724 2016
124+
(8 rows)
125+
126+
-- Test bitmap index scan
127+
SET enable_bitmapscan=on;
128+
SET enable_seqscan = off;
129+
EXPLAIN (costs off)
130+
SELECT count(*) FROM atstsh WHERE t @@ 'wr|qh';
131+
QUERY PLAN
132+
---------------------------------------------------
133+
Aggregate
134+
Disabled Nodes: 1
135+
-> Seq Scan on atstsh
136+
Disabled Nodes: 1
137+
Filter: (t @@ '''wr'' | ''qh'''::tsquery)
138+
(5 rows)
139+
140+
SELECT count(*) FROM atstsh WHERE t @@ 'wr|qh';
141+
count
142+
-------
143+
158
144+
(1 row)
145+
146+
SELECT count(*) FROM atstsh WHERE t @@ 'wr&qh';
147+
count
148+
-------
149+
17
150+
(1 row)
151+
152+
SELECT count(*) FROM atstsh WHERE t @@ 'eq&yt';
153+
count
154+
-------
155+
6
156+
(1 row)
157+
158+
SELECT count(*) FROM atstsh WHERE t @@ 'eq|yt';
159+
count
160+
-------
161+
98
162+
(1 row)
163+
164+
SELECT count(*) FROM atstsh WHERE t @@ '(eq&yt)|(wr&qh)';
165+
count
166+
-------
167+
23
168+
(1 row)
169+
170+
SELECT count(*) FROM atstsh WHERE t @@ '(eq|yt)&(wr|qh)';
171+
count
172+
-------
173+
39
174+
(1 row)
175+
176+
EXPLAIN (costs off)
177+
SELECT count(*) FROM atstsh WHERE d < '2016-05-16 14:21:25';
178+
QUERY PLAN
179+
-------------------------------------------------------------------------------
180+
Aggregate
181+
Disabled Nodes: 1
182+
-> Seq Scan on atstsh
183+
Disabled Nodes: 1
184+
Filter: (d < 'Mon May 16 14:21:25 2016'::timestamp without time zone)
185+
(5 rows)
186+
187+
SELECT count(*) FROM atstsh WHERE d < '2016-05-16 14:21:25';
188+
count
189+
-------
190+
357
191+
(1 row)
192+
193+
EXPLAIN (costs off)
194+
SELECT count(*) FROM atstsh WHERE d > '2016-05-16 14:21:25';
195+
QUERY PLAN
196+
-------------------------------------------------------------------------------
197+
Aggregate
198+
Disabled Nodes: 1
199+
-> Seq Scan on atstsh
200+
Disabled Nodes: 1
201+
Filter: (d > 'Mon May 16 14:21:25 2016'::timestamp without time zone)
202+
(5 rows)
203+
204+
SELECT count(*) FROM atstsh WHERE d > '2016-05-16 14:21:25';
205+
count
206+
-------
207+
153
208+
(1 row)
209+
210+
-- Test index scan
211+
SET enable_indexscan=on;
212+
SET enable_indexonlyscan=on;
213+
SET enable_bitmapscan=off;
214+
EXPLAIN (costs off)
215+
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM atstsh WHERE t @@ 'wr&qh' ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
216+
QUERY PLAN
217+
-------------------------------------------------------------------------------------
218+
Limit
219+
Disabled Nodes: 1
220+
-> Sort
221+
Disabled Nodes: 1
222+
Sort Key: ((d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone))
223+
-> Seq Scan on atstsh
224+
Disabled Nodes: 1
225+
Filter: (t @@ '''wr'' & ''qh'''::tsquery)
226+
(8 rows)
227+
228+
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM atstsh WHERE t @@ 'wr&qh' ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
229+
id | d | ?column?
230+
-----+---------------------------------+---------------
231+
355 | Mon May 16 14:21:22.326724 2016 | 2.673276
232+
354 | Mon May 16 13:21:22.326724 2016 | 3602.673276
233+
371 | Tue May 17 06:21:22.326724 2016 | 57597.326724
234+
406 | Wed May 18 17:21:22.326724 2016 | 183597.326724
235+
415 | Thu May 19 02:21:22.326724 2016 | 215997.326724
236+
(5 rows)
237+
238+
EXPLAIN (costs off)
239+
SELECT id, d, d <=| '2016-05-16 14:21:25' FROM atstsh WHERE t @@ 'wr&qh' ORDER BY d <=| '2016-05-16 14:21:25' LIMIT 5;
240+
QUERY PLAN
241+
-------------------------------------------------------------------------------------
242+
Limit
243+
Disabled Nodes: 1
244+
-> Sort
245+
Disabled Nodes: 1
246+
Sort Key: ((d <=| 'Mon May 16 14:21:25 2016'::timestamp without time zone))
247+
-> Seq Scan on atstsh
248+
Disabled Nodes: 1
249+
Filter: (t @@ '''wr'' & ''qh'''::tsquery)
250+
(8 rows)
251+
252+
SELECT id, d, d <=| '2016-05-16 14:21:25' FROM atstsh WHERE t @@ 'wr&qh' ORDER BY d <=| '2016-05-16 14:21:25' LIMIT 5;
253+
id | d | ?column?
254+
-----+---------------------------------+---------------
255+
355 | Mon May 16 14:21:22.326724 2016 | 2.673276
256+
354 | Mon May 16 13:21:22.326724 2016 | 3602.673276
257+
252 | Thu May 12 07:21:22.326724 2016 | 370802.673276
258+
232 | Wed May 11 11:21:22.326724 2016 | 442802.673276
259+
168 | Sun May 08 19:21:22.326724 2016 | 673202.673276
260+
(5 rows)
261+
262+
EXPLAIN (costs off)
263+
SELECT id, d, d |=> '2016-05-16 14:21:25' FROM atstsh WHERE t @@ 'wr&qh' ORDER BY d |=> '2016-05-16 14:21:25' LIMIT 5;
264+
QUERY PLAN
265+
-------------------------------------------------------------------------------------
266+
Limit
267+
Disabled Nodes: 1
268+
-> Sort
269+
Disabled Nodes: 1
270+
Sort Key: ((d |=> 'Mon May 16 14:21:25 2016'::timestamp without time zone))
271+
-> Seq Scan on atstsh
272+
Disabled Nodes: 1
273+
Filter: (t @@ '''wr'' & ''qh'''::tsquery)
274+
(8 rows)
275+
276+
SELECT id, d, d |=> '2016-05-16 14:21:25' FROM atstsh WHERE t @@ 'wr&qh' ORDER BY d |=> '2016-05-16 14:21:25' LIMIT 5;
277+
id | d | ?column?
278+
-----+---------------------------------+---------------
279+
371 | Tue May 17 06:21:22.326724 2016 | 57597.326724
280+
406 | Wed May 18 17:21:22.326724 2016 | 183597.326724
281+
415 | Thu May 19 02:21:22.326724 2016 | 215997.326724
282+
428 | Thu May 19 15:21:22.326724 2016 | 262797.326724
283+
457 | Fri May 20 20:21:22.326724 2016 | 367197.326724
284+
(5 rows)
285+
286+
EXPLAIN (costs off)
287+
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM atstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
288+
QUERY PLAN
289+
-------------------------------------------------------------------------------------
290+
Limit
291+
Disabled Nodes: 1
292+
-> Sort
293+
Disabled Nodes: 1
294+
Sort Key: ((d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone))
295+
-> Seq Scan on atstsh
296+
Disabled Nodes: 1
297+
(7 rows)
298+
299+
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM atstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
300+
id | d | ?column?
301+
-----+---------------------------------+-------------
302+
355 | Mon May 16 14:21:22.326724 2016 | 2.673276
303+
356 | Mon May 16 15:21:22.326724 2016 | 3597.326724
304+
354 | Mon May 16 13:21:22.326724 2016 | 3602.673276
305+
357 | Mon May 16 16:21:22.326724 2016 | 7197.326724
306+
353 | Mon May 16 12:21:22.326724 2016 | 7202.673276
307+
(5 rows)
308+
309+
EXPLAIN (costs off)
310+
SELECT id, d FROM atstsh WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER BY d;
311+
QUERY PLAN
312+
------------------------------------------------------------------------------------------------------------------------
313+
Sort
314+
Disabled Nodes: 1
315+
Sort Key: d
316+
-> Seq Scan on atstsh
317+
Disabled Nodes: 1
318+
Filter: ((t @@ '''wr'' & ''qh'''::tsquery) AND (d <= 'Mon May 16 14:21:25 2016'::timestamp without time zone))
319+
(6 rows)
320+
321+
SELECT id, d FROM atstsh WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER BY d;
322+
id | d
323+
-----+---------------------------------
324+
16 | Mon May 02 11:21:22.326724 2016
325+
39 | Tue May 03 10:21:22.326724 2016
326+
71 | Wed May 04 18:21:22.326724 2016
327+
135 | Sat May 07 10:21:22.326724 2016
328+
168 | Sun May 08 19:21:22.326724 2016
329+
232 | Wed May 11 11:21:22.326724 2016
330+
252 | Thu May 12 07:21:22.326724 2016
331+
354 | Mon May 16 13:21:22.326724 2016
332+
355 | Mon May 16 14:21:22.326724 2016
333+
(9 rows)
334+
335+
EXPLAIN (costs off)
336+
SELECT id, d FROM atstsh WHERE t @@ 'wr&qh' AND d >= '2016-05-16 14:21:25' ORDER BY d;
337+
QUERY PLAN
338+
------------------------------------------------------------------------------------------------------------------------
339+
Sort
340+
Disabled Nodes: 1
341+
Sort Key: d
342+
-> Seq Scan on atstsh
343+
Disabled Nodes: 1
344+
Filter: ((t @@ '''wr'' & ''qh'''::tsquery) AND (d >= 'Mon May 16 14:21:25 2016'::timestamp without time zone))
345+
(6 rows)
346+
347+
SELECT id, d FROM atstsh WHERE t @@ 'wr&qh' AND d >= '2016-05-16 14:21:25' ORDER BY d;
348+
id | d
349+
-----+---------------------------------
350+
371 | Tue May 17 06:21:22.326724 2016
351+
406 | Wed May 18 17:21:22.326724 2016
352+
415 | Thu May 19 02:21:22.326724 2016
353+
428 | Thu May 19 15:21:22.326724 2016
354+
457 | Fri May 20 20:21:22.326724 2016
355+
458 | Fri May 20 21:21:22.326724 2016
356+
484 | Sat May 21 23:21:22.326724 2016
357+
496 | Sun May 22 11:21:22.326724 2016
358+
(8 rows)
359+

‎expected/array.out

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*
66
* array.out - test output for 64-bit systems and
77
* array_1.out - test output for 32-bit systems.
8+
* array_2.out - test output for 64-bit systems (Rel 18).
9+
* array_3.out - test output for 32-bit systems (Rel 18).
810
*
911
*/
1012
set enable_seqscan=off;

‎expected/array_1.out

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*
66
* array.out - test output for 64-bit systems and
77
* array_1.out - test output for 32-bit systems.
8+
* array_2.out - test output for 64-bit systems (Rel 18).
9+
* array_3.out - test output for 32-bit systems (Rel 18).
810
*
911
*/
1012
set enable_seqscan=off;

‎expected/array_2.out

Lines changed: 925 additions & 0 deletions
Large diffs are not rendered by default.

‎expected/array_3.out

Lines changed: 918 additions & 0 deletions
Large diffs are not rendered by default.

‎expected/int8.out

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*
66
* int8.out - test output for 64-bit systems and
77
* int8_1.out - test output for 32-bit systems.
8+
* int8_3.out - test output for 32-bit systems (Rel 18).
89
*
910
*/
1011
set enable_seqscan=off;

‎expected/int8_1.out

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*
66
* int8.out - test output for 64-bit systems and
77
* int8_1.out - test output for 32-bit systems.
8+
* int8_3.out - test output for 32-bit systems (Rel 18).
89
*
910
*/
1011
set enable_seqscan=off;

‎expected/int8_3.out

Lines changed: 697 additions & 0 deletions
Large diffs are not rendered by default.

‎expected/orderby.out

Lines changed: 40 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -192,25 +192,6 @@ SELECT id, d, d |=> '2016-05-16 14:21:25' FROM tsts WHERE t @@ 'wr&qh' ORDER BY
192192
457 | Fri May 20 20:21:22.326724 2016 | 367197.326724
193193
(5 rows)
194194

195-
EXPLAIN (costs off)
196-
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
197-
QUERY PLAN
198-
-----------------------------------------------------------------------------------
199-
Limit
200-
-> Index Scan using tsts_idx on tsts
201-
Order By: (d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone)
202-
(3 rows)
203-
204-
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
205-
id | d | ?column?
206-
-----+---------------------------------+-------------
207-
355 | Mon May 16 14:21:22.326724 2016 | 2.673276
208-
356 | Mon May 16 15:21:22.326724 2016 | 3597.326724
209-
354 | Mon May 16 13:21:22.326724 2016 | 3602.673276
210-
357 | Mon May 16 16:21:22.326724 2016 | 7197.326724
211-
353 | Mon May 16 12:21:22.326724 2016 | 7202.673276
212-
(5 rows)
213-
214195
EXPLAIN (costs off)
215196
SELECT id, d FROM tsts WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER BY d;
216197
QUERY PLAN
@@ -262,6 +243,26 @@ SELECT id, d FROM tsts WHERE t @@ 'wr&qh' AND d >= '2016-05-16 14:21:25' ORDER
262243
496 | Sun May 22 11:21:22.326724 2016
263244
(8 rows)
264245

246+
RESET enable_indexscan;
247+
EXPLAIN (costs off)
248+
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
249+
QUERY PLAN
250+
-----------------------------------------------------------------------------------
251+
Limit
252+
-> Index Scan using tsts_idx on tsts
253+
Order By: (d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone)
254+
(3 rows)
255+
256+
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
257+
id | d | ?column?
258+
-----+---------------------------------+-------------
259+
355 | Mon May 16 14:21:22.326724 2016 | 2.673276
260+
356 | Mon May 16 15:21:22.326724 2016 | 3597.326724
261+
354 | Mon May 16 13:21:22.326724 2016 | 3602.673276
262+
357 | Mon May 16 16:21:22.326724 2016 | 7197.326724
263+
353 | Mon May 16 12:21:22.326724 2016 | 7202.673276
264+
(5 rows)
265+
265266
-- Test index scan
266267
RESET enable_indexscan;
267268
RESET enable_indexonlyscan;
@@ -371,25 +372,6 @@ SELECT id, d, d |=> '2016-05-16 14:21:25' FROM tsts WHERE t @@ 'wr&qh' ORDER BY
371372
457 | Fri May 20 20:21:22.326724 2016 | 367197.326724
372373
(5 rows)
373374

374-
EXPLAIN (costs off)
375-
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
376-
QUERY PLAN
377-
-----------------------------------------------------------------------------------
378-
Limit
379-
-> Index Scan using tsts_idx on tsts
380-
Order By: (d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone)
381-
(3 rows)
382-
383-
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
384-
id | d | ?column?
385-
-----+---------------------------------+-------------
386-
355 | Mon May 16 14:21:22.326724 2016 | 2.673276
387-
356 | Mon May 16 15:21:22.326724 2016 | 3597.326724
388-
354 | Mon May 16 13:21:22.326724 2016 | 3602.673276
389-
357 | Mon May 16 16:21:22.326724 2016 | 7197.326724
390-
353 | Mon May 16 12:21:22.326724 2016 | 7202.673276
391-
(5 rows)
392-
393375
EXPLAIN (costs off)
394376
SELECT id, d FROM tsts WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER BY d;
395377
QUERY PLAN
@@ -469,6 +451,26 @@ SELECT id, d FROM tsts WHERE t @@ 'wr&qh' AND d >= '2016-05-16 14:21:25' ORDER
469451
458 | Fri May 20 21:21:22.326724 2016
470452
(3 rows)
471453

454+
RESET enable_indexscan;
455+
EXPLAIN (costs off)
456+
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
457+
QUERY PLAN
458+
-----------------------------------------------------------------------------------
459+
Limit
460+
-> Index Scan using tsts_idx on tsts
461+
Order By: (d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone)
462+
(3 rows)
463+
464+
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
465+
id | d | ?column?
466+
-----+---------------------------------+-------------
467+
355 | Mon May 16 14:21:22.326724 2016 | 2.673276
468+
356 | Mon May 16 15:21:22.326724 2016 | 3597.326724
469+
354 | Mon May 16 13:21:22.326724 2016 | 3602.673276
470+
357 | Mon May 16 16:21:22.326724 2016 | 7197.326724
471+
353 | Mon May 16 12:21:22.326724 2016 | 7202.673276
472+
(5 rows)
473+
472474
-- Test "ORDER BY" error message
473475
DROP INDEX tsts_idx;
474476
CREATE INDEX tsts_idx ON tsts USING rum (t rum_tsvector_addon_ops, d);

‎expected/orderby_1.out

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -192,17 +192,6 @@ SELECT id, d, d |=> '2016-05-16 14:21:25' FROM tsts WHERE t @@ 'wr&qh' ORDER BY
192192
457 | Fri May 20 20:21:22.326724 2016 | 367197.326724
193193
(5 rows)
194194

195-
EXPLAIN (costs off)
196-
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
197-
QUERY PLAN
198-
-----------------------------------------------------------------------------------
199-
Limit
200-
-> Index Scan using tsts_idx on tsts
201-
Order By: (d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone)
202-
(3 rows)
203-
204-
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
205-
ERROR: doesn't support order by over pass-by-reference column
206195
EXPLAIN (costs off)
207196
SELECT id, d FROM tsts WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER BY d;
208197
QUERY PLAN
@@ -254,6 +243,18 @@ SELECT id, d FROM tsts WHERE t @@ 'wr&qh' AND d >= '2016-05-16 14:21:25' ORDER
254243
496 | Sun May 22 11:21:22.326724 2016
255244
(8 rows)
256245

246+
RESET enable_indexscan;
247+
EXPLAIN (costs off)
248+
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
249+
QUERY PLAN
250+
-----------------------------------------------------------------------------------
251+
Limit
252+
-> Index Scan using tsts_idx on tsts
253+
Order By: (d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone)
254+
(3 rows)
255+
256+
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
257+
ERROR: doesn't support order by over pass-by-reference column
257258
-- Test index scan
258259
RESET enable_indexscan;
259260
RESET enable_indexonlyscan;
@@ -340,17 +341,6 @@ SELECT id, d, d |=> '2016-05-16 14:21:25' FROM tsts WHERE t @@ 'wr&qh' ORDER BY
340341
SELECT id, d, d |=> '2016-05-16 14:21:25' FROM tsts WHERE t @@ 'wr&qh' ORDER BY d |=> '2016-05-16 14:21:25' LIMIT 5;
341342
ERROR: doesn't support order by over pass-by-reference column
342343
EXPLAIN (costs off)
343-
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
344-
QUERY PLAN
345-
-----------------------------------------------------------------------------------
346-
Limit
347-
-> Index Scan using tsts_idx on tsts
348-
Order By: (d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone)
349-
(3 rows)
350-
351-
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
352-
ERROR: doesn't support order by over pass-by-reference column
353-
EXPLAIN (costs off)
354344
SELECT id, d FROM tsts WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER BY d;
355345
QUERY PLAN
356346
----------------------------------------------------------------------------------------------------------------------------
@@ -429,6 +419,18 @@ SELECT id, d FROM tsts WHERE t @@ 'wr&qh' AND d >= '2016-05-16 14:21:25' ORDER
429419
458 | Fri May 20 21:21:22.326724 2016
430420
(3 rows)
431421

422+
RESET enable_indexscan;
423+
EXPLAIN (costs off)
424+
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
425+
QUERY PLAN
426+
-----------------------------------------------------------------------------------
427+
Limit
428+
-> Index Scan using tsts_idx on tsts
429+
Order By: (d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone)
430+
(3 rows)
431+
432+
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
433+
ERROR: doesn't support order by over pass-by-reference column
432434
-- Test "ORDER BY" error message
433435
DROP INDEX tsts_idx;
434436
CREATE INDEX tsts_idx ON tsts USING rum (t rum_tsvector_addon_ops, d);

‎expected/orderby_hash.out

Lines changed: 40 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -192,25 +192,6 @@ SELECT id, d, d |=> '2016-05-16 14:21:25' FROM tstsh WHERE t @@ 'wr&qh' ORDER BY
192192
457 | Fri May 20 20:21:22.326724 2016 | 367197.326724
193193
(5 rows)
194194

195-
EXPLAIN (costs off)
196-
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
197-
QUERY PLAN
198-
-----------------------------------------------------------------------------------
199-
Limit
200-
-> Index Scan using tstsh_idx on tstsh
201-
Order By: (d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone)
202-
(3 rows)
203-
204-
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
205-
id | d | ?column?
206-
-----+---------------------------------+-------------
207-
355 | Mon May 16 14:21:22.326724 2016 | 2.673276
208-
356 | Mon May 16 15:21:22.326724 2016 | 3597.326724
209-
354 | Mon May 16 13:21:22.326724 2016 | 3602.673276
210-
357 | Mon May 16 16:21:22.326724 2016 | 7197.326724
211-
353 | Mon May 16 12:21:22.326724 2016 | 7202.673276
212-
(5 rows)
213-
214195
EXPLAIN (costs off)
215196
SELECT id, d FROM tstsh WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER BY d;
216197
QUERY PLAN
@@ -262,6 +243,26 @@ SELECT id, d FROM tstsh WHERE t @@ 'wr&qh' AND d >= '2016-05-16 14:21:25' ORDER
262243
496 | Sun May 22 11:21:22.326724 2016
263244
(8 rows)
264245

246+
RESET enable_indexscan;
247+
EXPLAIN (costs off)
248+
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
249+
QUERY PLAN
250+
-----------------------------------------------------------------------------------
251+
Limit
252+
-> Index Scan using tstsh_idx on tstsh
253+
Order By: (d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone)
254+
(3 rows)
255+
256+
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
257+
id | d | ?column?
258+
-----+---------------------------------+-------------
259+
355 | Mon May 16 14:21:22.326724 2016 | 2.673276
260+
356 | Mon May 16 15:21:22.326724 2016 | 3597.326724
261+
354 | Mon May 16 13:21:22.326724 2016 | 3602.673276
262+
357 | Mon May 16 16:21:22.326724 2016 | 7197.326724
263+
353 | Mon May 16 12:21:22.326724 2016 | 7202.673276
264+
(5 rows)
265+
265266
-- Test index scan
266267
RESET enable_indexscan;
267268
RESET enable_indexonlyscan;
@@ -371,25 +372,6 @@ SELECT id, d, d |=> '2016-05-16 14:21:25' FROM tstsh WHERE t @@ 'wr&qh' ORDER BY
371372
457 | Fri May 20 20:21:22.326724 2016 | 367197.326724
372373
(5 rows)
373374

374-
EXPLAIN (costs off)
375-
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
376-
QUERY PLAN
377-
-----------------------------------------------------------------------------------
378-
Limit
379-
-> Index Scan using tstsh_idx on tstsh
380-
Order By: (d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone)
381-
(3 rows)
382-
383-
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
384-
id | d | ?column?
385-
-----+---------------------------------+-------------
386-
355 | Mon May 16 14:21:22.326724 2016 | 2.673276
387-
356 | Mon May 16 15:21:22.326724 2016 | 3597.326724
388-
354 | Mon May 16 13:21:22.326724 2016 | 3602.673276
389-
357 | Mon May 16 16:21:22.326724 2016 | 7197.326724
390-
353 | Mon May 16 12:21:22.326724 2016 | 7202.673276
391-
(5 rows)
392-
393375
EXPLAIN (costs off)
394376
SELECT id, d FROM tstsh WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER BY d;
395377
QUERY PLAN
@@ -469,6 +451,26 @@ SELECT id, d FROM tstsh WHERE t @@ 'wr&qh' AND d >= '2016-05-16 14:21:25' ORDER
469451
458 | Fri May 20 21:21:22.326724 2016
470452
(3 rows)
471453

454+
RESET enable_indexscan;
455+
EXPLAIN (costs off)
456+
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
457+
QUERY PLAN
458+
-----------------------------------------------------------------------------------
459+
Limit
460+
-> Index Scan using tstsh_idx on tstsh
461+
Order By: (d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone)
462+
(3 rows)
463+
464+
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
465+
id | d | ?column?
466+
-----+---------------------------------+-------------
467+
355 | Mon May 16 14:21:22.326724 2016 | 2.673276
468+
356 | Mon May 16 15:21:22.326724 2016 | 3597.326724
469+
354 | Mon May 16 13:21:22.326724 2016 | 3602.673276
470+
357 | Mon May 16 16:21:22.326724 2016 | 7197.326724
471+
353 | Mon May 16 12:21:22.326724 2016 | 7202.673276
472+
(5 rows)
473+
472474
-- Test multicolumn index
473475
RESET enable_indexscan;
474476
RESET enable_indexonlyscan;

‎expected/orderby_hash_1.out

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -192,17 +192,6 @@ SELECT id, d, d |=> '2016-05-16 14:21:25' FROM tstsh WHERE t @@ 'wr&qh' ORDER BY
192192
457 | Fri May 20 20:21:22.326724 2016 | 367197.326724
193193
(5 rows)
194194

195-
EXPLAIN (costs off)
196-
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
197-
QUERY PLAN
198-
-----------------------------------------------------------------------------------
199-
Limit
200-
-> Index Scan using tstsh_idx on tstsh
201-
Order By: (d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone)
202-
(3 rows)
203-
204-
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
205-
ERROR: doesn't support order by over pass-by-reference column
206195
EXPLAIN (costs off)
207196
SELECT id, d FROM tstsh WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER BY d;
208197
QUERY PLAN
@@ -254,6 +243,18 @@ SELECT id, d FROM tstsh WHERE t @@ 'wr&qh' AND d >= '2016-05-16 14:21:25' ORDER
254243
496 | Sun May 22 11:21:22.326724 2016
255244
(8 rows)
256245

246+
RESET enable_indexscan;
247+
EXPLAIN (costs off)
248+
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
249+
QUERY PLAN
250+
-----------------------------------------------------------------------------------
251+
Limit
252+
-> Index Scan using tstsh_idx on tstsh
253+
Order By: (d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone)
254+
(3 rows)
255+
256+
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
257+
ERROR: doesn't support order by over pass-by-reference column
257258
-- Test index scan
258259
RESET enable_indexscan;
259260
RESET enable_indexonlyscan;
@@ -340,17 +341,6 @@ SELECT id, d, d |=> '2016-05-16 14:21:25' FROM tstsh WHERE t @@ 'wr&qh' ORDER BY
340341
SELECT id, d, d |=> '2016-05-16 14:21:25' FROM tstsh WHERE t @@ 'wr&qh' ORDER BY d |=> '2016-05-16 14:21:25' LIMIT 5;
341342
ERROR: doesn't support order by over pass-by-reference column
342343
EXPLAIN (costs off)
343-
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
344-
QUERY PLAN
345-
-----------------------------------------------------------------------------------
346-
Limit
347-
-> Index Scan using tstsh_idx on tstsh
348-
Order By: (d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone)
349-
(3 rows)
350-
351-
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
352-
ERROR: doesn't support order by over pass-by-reference column
353-
EXPLAIN (costs off)
354344
SELECT id, d FROM tstsh WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER BY d;
355345
QUERY PLAN
356346
----------------------------------------------------------------------------------------------------------------------------
@@ -429,6 +419,18 @@ SELECT id, d FROM tstsh WHERE t @@ 'wr&qh' AND d >= '2016-05-16 14:21:25' ORDER
429419
458 | Fri May 20 21:21:22.326724 2016
430420
(3 rows)
431421

422+
RESET enable_indexscan;
423+
EXPLAIN (costs off)
424+
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
425+
QUERY PLAN
426+
-----------------------------------------------------------------------------------
427+
Limit
428+
-> Index Scan using tstsh_idx on tstsh
429+
Order By: (d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone)
430+
(3 rows)
431+
432+
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
433+
ERROR: doesn't support order by over pass-by-reference column
432434
-- Test multicolumn index
433435
RESET enable_indexscan;
434436
RESET enable_indexonlyscan;

‎expected/rum.out

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ SELECT
163163
rum_ts_distance(a, to_tsquery('pg_catalog.english', 'way & (go | half)'))::numeric(10,4),
164164
*
165165
FROM test_rum
166+
WHERE a @@ to_tsquery('pg_catalog.english', 'way & (go | half)')
166167
ORDER BY a <=> to_tsquery('pg_catalog.english', 'way & (go | half)') limit 2;
167168
distance | rum_ts_distance | t | a
168169
----------+-----------------+---------------------------------------------------------------------+---------------------------------------------------------

‎expected/rum_hash.out

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ SELECT
150150
rum_ts_score(a, to_tsquery('pg_catalog.english', 'way & (go | half)'))::numeric(10,6),
151151
*
152152
FROM test_rum_hash
153+
WHERE a @@ to_tsquery('pg_catalog.english', 'way & (go | half)')
153154
ORDER BY a <=> to_tsquery('pg_catalog.english', 'way & (go | half)') limit 2;
154155
distance | rum_ts_distance | rum_ts_score | t | a
155156
----------+-----------------+--------------+---------------------------------------------------------------------+---------------------------------------------------------

‎expected/text.out

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/*
2+
* ------------------------------------
3+
* NOTE: This test behaves differenly
4+
* ------------------------------------
5+
*
6+
* text.out - test output for 32/64-bit systems.
7+
* text_2.out - test output for 32/64-bit systems (Rel 18).
8+
*
9+
*/
110
set enable_seqscan=off;
211
CREATE TABLE test_text (
312
i text

‎expected/text_2.out

Lines changed: 334 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,334 @@
1+
/*
2+
* ------------------------------------
3+
* NOTE: This test behaves differenly
4+
* ------------------------------------
5+
*
6+
* text.out - test output for 32/64-bit systems.
7+
* text_2.out - test output for 32/64-bit systems (Rel 18).
8+
*
9+
*/
10+
set enable_seqscan=off;
11+
CREATE TABLE test_text (
12+
i text
13+
);
14+
INSERT INTO test_text VALUES ('a'),('ab'),('abc'),('abb'),('axy'),('xyz');
15+
CREATE INDEX idx_text ON test_text USING rum (i);
16+
SELECT * FROM test_text WHERE i<'abc' ORDER BY i;
17+
i
18+
-----
19+
a
20+
ab
21+
abb
22+
(3 rows)
23+
24+
SELECT * FROM test_text WHERE i<='abc' ORDER BY i;
25+
i
26+
-----
27+
a
28+
ab
29+
abb
30+
abc
31+
(4 rows)
32+
33+
SELECT * FROM test_text WHERE i='abc' ORDER BY i;
34+
i
35+
-----
36+
abc
37+
(1 row)
38+
39+
SELECT * FROM test_text WHERE i>='abc' ORDER BY i;
40+
i
41+
-----
42+
abc
43+
axy
44+
xyz
45+
(3 rows)
46+
47+
SELECT * FROM test_text WHERE i>'abc' ORDER BY i;
48+
i
49+
-----
50+
axy
51+
xyz
52+
(2 rows)
53+
54+
CREATE TABLE test_text_o AS SELECT id::text, t FROM tsts;
55+
SELECT id FROM test_text_o WHERE t @@ 'wr&qh' AND id <= '400' ORDER BY id;
56+
id
57+
-----
58+
135
59+
16
60+
168
61+
232
62+
252
63+
354
64+
355
65+
371
66+
39
67+
(9 rows)
68+
69+
SELECT id FROM test_text_o WHERE t @@ 'wr&qh' AND id >= '400' ORDER BY id;
70+
id
71+
-----
72+
406
73+
415
74+
428
75+
457
76+
458
77+
484
78+
496
79+
71
80+
(8 rows)
81+
82+
CREATE INDEX test_text_o_idx ON test_text_o USING rum
83+
(t rum_tsvector_addon_ops, id)
84+
WITH (attach = 'id', to = 't');
85+
RESET enable_indexscan;
86+
RESET enable_indexonlyscan;
87+
SET enable_bitmapscan=OFF;
88+
SET enable_seqscan = off;
89+
EXPLAIN (costs off)
90+
SELECT id FROM test_text_o WHERE t @@ 'wr&qh' AND id <= '400' ORDER BY id;
91+
QUERY PLAN
92+
---------------------------------------------------------------------------------
93+
Sort
94+
Sort Key: id
95+
-> Index Scan using test_text_o_idx on test_text_o
96+
Index Cond: ((t @@ '''wr'' & ''qh'''::tsquery) AND (id <= '400'::text))
97+
(4 rows)
98+
99+
SELECT id FROM test_text_o WHERE t @@ 'wr&qh' AND id <= '400' ORDER BY id;
100+
id
101+
-----
102+
135
103+
16
104+
168
105+
232
106+
252
107+
354
108+
355
109+
371
110+
39
111+
(9 rows)
112+
113+
EXPLAIN (costs off)
114+
SELECT id FROM test_text_o WHERE t @@ 'wr&qh' AND id >= '400' ORDER BY id;
115+
QUERY PLAN
116+
---------------------------------------------------------------------------------
117+
Sort
118+
Sort Key: id
119+
-> Index Scan using test_text_o_idx on test_text_o
120+
Index Cond: ((t @@ '''wr'' & ''qh'''::tsquery) AND (id >= '400'::text))
121+
(4 rows)
122+
123+
SELECT id FROM test_text_o WHERE t @@ 'wr&qh' AND id >= '400' ORDER BY id;
124+
id
125+
-----
126+
406
127+
415
128+
428
129+
457
130+
458
131+
484
132+
496
133+
71
134+
(8 rows)
135+
136+
CREATE TABLE test_text_a AS SELECT id::text, t FROM tsts;
137+
-- Should fail, temporarly it isn't allowed to order an index over pass-by-reference column
138+
CREATE INDEX test_text_a_idx ON test_text_a USING rum
139+
(t rum_tsvector_addon_ops, id)
140+
WITH (attach = 'id', to = 't', order_by_attach='t');
141+
ERROR: doesn't support order index over pass-by-reference column
142+
EXPLAIN (costs off)
143+
SELECT count(*) FROM test_text_a WHERE id < '400';
144+
QUERY PLAN
145+
------------------------------------
146+
Aggregate
147+
Disabled Nodes: 1
148+
-> Seq Scan on test_text_a
149+
Disabled Nodes: 1
150+
Filter: (id < '400'::text)
151+
(5 rows)
152+
153+
SELECT count(*) FROM test_text_a WHERE id < '400';
154+
count
155+
-------
156+
337
157+
(1 row)
158+
159+
EXPLAIN (costs off)
160+
SELECT id FROM test_text_a WHERE t @@ 'wr&qh' AND id <= '400' ORDER BY id;
161+
QUERY PLAN
162+
-----------------------------------------------------------------------------
163+
Sort
164+
Disabled Nodes: 1
165+
Sort Key: id
166+
-> Seq Scan on test_text_a
167+
Disabled Nodes: 1
168+
Filter: ((t @@ '''wr'' & ''qh'''::tsquery) AND (id <= '400'::text))
169+
(6 rows)
170+
171+
SELECT id FROM test_text_a WHERE t @@ 'wr&qh' AND id <= '400' ORDER BY id;
172+
id
173+
-----
174+
135
175+
16
176+
168
177+
232
178+
252
179+
354
180+
355
181+
371
182+
39
183+
(9 rows)
184+
185+
EXPLAIN (costs off)
186+
SELECT id FROM test_text_a WHERE t @@ 'wr&qh' AND id >= '400' ORDER BY id;
187+
QUERY PLAN
188+
-----------------------------------------------------------------------------
189+
Sort
190+
Disabled Nodes: 1
191+
Sort Key: id
192+
-> Seq Scan on test_text_a
193+
Disabled Nodes: 1
194+
Filter: ((t @@ '''wr'' & ''qh'''::tsquery) AND (id >= '400'::text))
195+
(6 rows)
196+
197+
SELECT id FROM test_text_a WHERE t @@ 'wr&qh' AND id >= '400' ORDER BY id;
198+
id
199+
-----
200+
406
201+
415
202+
428
203+
457
204+
458
205+
484
206+
496
207+
71
208+
(8 rows)
209+
210+
CREATE TABLE test_text_h_o AS SELECT id::text, t FROM tsts;
211+
CREATE INDEX test_text_h_o_idx ON test_text_h_o USING rum
212+
(t rum_tsvector_hash_addon_ops, id)
213+
WITH (attach = 'id', to = 't');
214+
EXPLAIN (costs off)
215+
SELECT id FROM test_text_h_o WHERE t @@ 'wr&qh' AND id <= '400' ORDER BY id;
216+
QUERY PLAN
217+
---------------------------------------------------------------------------------
218+
Sort
219+
Sort Key: id
220+
-> Index Scan using test_text_h_o_idx on test_text_h_o
221+
Index Cond: ((t @@ '''wr'' & ''qh'''::tsquery) AND (id <= '400'::text))
222+
(4 rows)
223+
224+
SELECT id FROM test_text_h_o WHERE t @@ 'wr&qh' AND id <= '400' ORDER BY id;
225+
id
226+
-----
227+
135
228+
16
229+
168
230+
232
231+
252
232+
354
233+
355
234+
371
235+
39
236+
(9 rows)
237+
238+
EXPLAIN (costs off)
239+
SELECT id FROM test_text_h_o WHERE t @@ 'wr&qh' AND id >= '400' ORDER BY id;
240+
QUERY PLAN
241+
---------------------------------------------------------------------------------
242+
Sort
243+
Sort Key: id
244+
-> Index Scan using test_text_h_o_idx on test_text_h_o
245+
Index Cond: ((t @@ '''wr'' & ''qh'''::tsquery) AND (id >= '400'::text))
246+
(4 rows)
247+
248+
SELECT id FROM test_text_h_o WHERE t @@ 'wr&qh' AND id >= '400' ORDER BY id;
249+
id
250+
-----
251+
406
252+
415
253+
428
254+
457
255+
458
256+
484
257+
496
258+
71
259+
(8 rows)
260+
261+
CREATE TABLE test_text_h_a AS SELECT id::text, t FROM tsts;
262+
-- Should fail, temporarly it isn't allowed to order an index over pass-by-reference column
263+
CREATE INDEX test_text_h_a_idx ON test_text_h_a USING rum
264+
(t rum_tsvector_hash_addon_ops, id)
265+
WITH (attach = 'id', to = 't', order_by_attach='t');
266+
ERROR: doesn't support order index over pass-by-reference column
267+
EXPLAIN (costs off)
268+
SELECT count(*) FROM test_text_h_a WHERE id < '400';
269+
QUERY PLAN
270+
------------------------------------
271+
Aggregate
272+
Disabled Nodes: 1
273+
-> Seq Scan on test_text_h_a
274+
Disabled Nodes: 1
275+
Filter: (id < '400'::text)
276+
(5 rows)
277+
278+
SELECT count(*) FROM test_text_h_a WHERE id < '400';
279+
count
280+
-------
281+
337
282+
(1 row)
283+
284+
EXPLAIN (costs off)
285+
SELECT id FROM test_text_h_a WHERE t @@ 'wr&qh' AND id <= '400' ORDER BY id;
286+
QUERY PLAN
287+
-----------------------------------------------------------------------------
288+
Sort
289+
Disabled Nodes: 1
290+
Sort Key: id
291+
-> Seq Scan on test_text_h_a
292+
Disabled Nodes: 1
293+
Filter: ((t @@ '''wr'' & ''qh'''::tsquery) AND (id <= '400'::text))
294+
(6 rows)
295+
296+
SELECT id FROM test_text_h_a WHERE t @@ 'wr&qh' AND id <= '400' ORDER BY id;
297+
id
298+
-----
299+
135
300+
16
301+
168
302+
232
303+
252
304+
354
305+
355
306+
371
307+
39
308+
(9 rows)
309+
310+
EXPLAIN (costs off)
311+
SELECT id FROM test_text_h_a WHERE t @@ 'wr&qh' AND id >= '400' ORDER BY id;
312+
QUERY PLAN
313+
-----------------------------------------------------------------------------
314+
Sort
315+
Disabled Nodes: 1
316+
Sort Key: id
317+
-> Seq Scan on test_text_h_a
318+
Disabled Nodes: 1
319+
Filter: ((t @@ '''wr'' & ''qh'''::tsquery) AND (id >= '400'::text))
320+
(6 rows)
321+
322+
SELECT id FROM test_text_h_a WHERE t @@ 'wr&qh' AND id >= '400' ORDER BY id;
323+
id
324+
-----
325+
406
326+
415
327+
428
328+
457
329+
458
330+
484
331+
496
332+
71
333+
(8 rows)
334+

‎sql/altorder.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*
66
* altorder.out - test output for 64-bit systems and
77
* altorder_1.out - test output for 32-bit systems.
8+
* altorder_3.out - test output for 32-bit systems (Rel 18).
89
*
910
*/
1011

‎sql/altorder_hash.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*
66
* altorder_hash.out - test output for 64-bit systems and
77
* altorder_hash_1.out - test output for 32-bit systems.
8+
* altorder_hash_3.out - test output for 32-bit systems (Rel 18).
89
*
910
*/
1011

‎sql/array.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*
66
* array.out - test output for 64-bit systems and
77
* array_1.out - test output for 32-bit systems.
8+
* array_2.out - test output for 64-bit systems (Rel 18).
9+
* array_3.out - test output for 32-bit systems (Rel 18).
810
*
911
*/
1012

‎sql/int8.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*
66
* int8.out - test output for 64-bit systems and
77
* int8_1.out - test output for 32-bit systems.
8+
* int8_3.out - test output for 32-bit systems (Rel 18).
89
*
910
*/
1011

‎sql/orderby.sql

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,18 @@ EXPLAIN (costs off)
5454
SELECT id, d, d |=> '2016-05-16 14:21:25' FROM tsts WHERE t @@ 'wr&qh' ORDER BY d |=> '2016-05-16 14:21:25' LIMIT 5;
5555
SELECT id, d, d |=> '2016-05-16 14:21:25' FROM tsts WHERE t @@ 'wr&qh' ORDER BY d |=> '2016-05-16 14:21:25' LIMIT 5;
5656

57-
EXPLAIN (costs off)
58-
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
59-
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
60-
6157
EXPLAIN (costs off)
6258
SELECT id, d FROM tsts WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER BY d;
6359
SELECT id, d FROM tsts WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER BY d;
6460
EXPLAIN (costs off)
6561
SELECT id, d FROM tsts WHERE t @@ 'wr&qh' AND d >= '2016-05-16 14:21:25' ORDER BY d;
6662
SELECT id, d FROM tsts WHERE t @@ 'wr&qh' AND d >= '2016-05-16 14:21:25' ORDER BY d;
6763

64+
RESET enable_indexscan;
65+
EXPLAIN (costs off)
66+
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
67+
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
68+
6869
-- Test index scan
6970
RESET enable_indexscan;
7071
RESET enable_indexonlyscan;
@@ -89,10 +90,6 @@ EXPLAIN (costs off)
8990
SELECT id, d, d |=> '2016-05-16 14:21:25' FROM tsts WHERE t @@ 'wr&qh' ORDER BY d |=> '2016-05-16 14:21:25' LIMIT 5;
9091
SELECT id, d, d |=> '2016-05-16 14:21:25' FROM tsts WHERE t @@ 'wr&qh' ORDER BY d |=> '2016-05-16 14:21:25' LIMIT 5;
9192

92-
EXPLAIN (costs off)
93-
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
94-
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
95-
9693
EXPLAIN (costs off)
9794
SELECT id, d FROM tsts WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER BY d;
9895
SELECT id, d FROM tsts WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER BY d;
@@ -106,6 +103,11 @@ SELECT id, d FROM tsts WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER
106103
SELECT id, d FROM tsts WHERE t @@ 'wr&qh' AND d >= '2016-05-16 14:21:25' ORDER BY d ASC LIMIT 3;
107104
SELECT id, d FROM tsts WHERE t @@ 'wr&qh' AND d >= '2016-05-16 14:21:25' ORDER BY d DESC LIMIT 3;
108105

106+
RESET enable_indexscan;
107+
EXPLAIN (costs off)
108+
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
109+
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
110+
109111
-- Test "ORDER BY" error message
110112
DROP INDEX tsts_idx;
111113

‎sql/orderby_hash.sql

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,18 @@ EXPLAIN (costs off)
5454
SELECT id, d, d |=> '2016-05-16 14:21:25' FROM tstsh WHERE t @@ 'wr&qh' ORDER BY d |=> '2016-05-16 14:21:25' LIMIT 5;
5555
SELECT id, d, d |=> '2016-05-16 14:21:25' FROM tstsh WHERE t @@ 'wr&qh' ORDER BY d |=> '2016-05-16 14:21:25' LIMIT 5;
5656

57-
EXPLAIN (costs off)
58-
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
59-
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
60-
6157
EXPLAIN (costs off)
6258
SELECT id, d FROM tstsh WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER BY d;
6359
SELECT id, d FROM tstsh WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER BY d;
6460
EXPLAIN (costs off)
6561
SELECT id, d FROM tstsh WHERE t @@ 'wr&qh' AND d >= '2016-05-16 14:21:25' ORDER BY d;
6662
SELECT id, d FROM tstsh WHERE t @@ 'wr&qh' AND d >= '2016-05-16 14:21:25' ORDER BY d;
6763

64+
RESET enable_indexscan;
65+
EXPLAIN (costs off)
66+
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
67+
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
68+
6869
-- Test index scan
6970
RESET enable_indexscan;
7071
RESET enable_indexonlyscan;
@@ -89,10 +90,6 @@ EXPLAIN (costs off)
8990
SELECT id, d, d |=> '2016-05-16 14:21:25' FROM tstsh WHERE t @@ 'wr&qh' ORDER BY d |=> '2016-05-16 14:21:25' LIMIT 5;
9091
SELECT id, d, d |=> '2016-05-16 14:21:25' FROM tstsh WHERE t @@ 'wr&qh' ORDER BY d |=> '2016-05-16 14:21:25' LIMIT 5;
9192

92-
EXPLAIN (costs off)
93-
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
94-
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
95-
9693
EXPLAIN (costs off)
9794
SELECT id, d FROM tstsh WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER BY d;
9895
SELECT id, d FROM tstsh WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER BY d;
@@ -106,6 +103,11 @@ SELECT id, d FROM tstsh WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER
106103
SELECT id, d FROM tstsh WHERE t @@ 'wr&qh' AND d >= '2016-05-16 14:21:25' ORDER BY d ASC LIMIT 3;
107104
SELECT id, d FROM tstsh WHERE t @@ 'wr&qh' AND d >= '2016-05-16 14:21:25' ORDER BY d DESC LIMIT 3;
108105

106+
RESET enable_indexscan;
107+
EXPLAIN (costs off)
108+
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
109+
SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
110+
109111
-- Test multicolumn index
110112

111113
RESET enable_indexscan;

‎sql/rum.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ SELECT
6464
rum_ts_distance(a, to_tsquery('pg_catalog.english', 'way & (go | half)'))::numeric(10,4),
6565
*
6666
FROM test_rum
67+
WHERE a @@ to_tsquery('pg_catalog.english', 'way & (go | half)')
6768
ORDER BY a <=> to_tsquery('pg_catalog.english', 'way & (go | half)') limit 2;
6869

6970
-- Check ranking normalization

‎sql/rum_hash.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ SELECT
5353
rum_ts_score(a, to_tsquery('pg_catalog.english', 'way & (go | half)'))::numeric(10,6),
5454
*
5555
FROM test_rum_hash
56+
WHERE a @@ to_tsquery('pg_catalog.english', 'way & (go | half)')
5657
ORDER BY a <=> to_tsquery('pg_catalog.english', 'way & (go | half)') limit 2;
5758

5859
-- Check ranking normalization

‎sql/text.sql

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/*
2+
* ------------------------------------
3+
* NOTE: This test behaves differenly
4+
* ------------------------------------
5+
*
6+
* text.out - test output for 32/64-bit systems.
7+
* text_2.out - test output for 32/64-bit systems (Rel 18).
8+
*
9+
*/
110
set enable_seqscan=off;
211

312
CREATE TABLE test_text (

0 commit comments

Comments
 (0)
Please sign in to comment.