Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 060ae1f

Browse files
committed
[PGPRO-11393] Added test for "ORDER BY" error message
If the "rum" index is created without the "WITH" operator, two columns must be specified for "ORDER BY" to work. Added a test that checks for an error message if only one column is specified in the "ORDER BY". Tags: rum
1 parent 53948ec commit 060ae1f

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

expected/orderby.out

+9
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,15 @@ SELECT id, d FROM tsts WHERE t @@ 'wr&qh' AND d >= '2016-05-16 14:21:25' ORDER
460460
458 | Fri May 20 21:21:22.326724 2016
461461
(3 rows)
462462

463+
-- Test "ORDER BY" error message
464+
DROP INDEX tsts_idx;
465+
RESET enable_indexscan;
466+
RESET enable_indexonlyscan;
467+
RESET enable_bitmapscan;
468+
RESET enable_seqscan;
469+
CREATE INDEX tsts_idx ON tsts USING rum (t rum_tsvector_addon_ops, d);
470+
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;
471+
ERROR: cannot order without attribute 2 in WHERE clause
463472
-- Test multicolumn index
464473
RESET enable_indexscan;
465474
RESET enable_indexonlyscan;

sql/orderby.sql

+12
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,18 @@ SELECT id, d FROM tsts WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER
9595
SELECT id, d FROM tsts WHERE t @@ 'wr&qh' AND d >= '2016-05-16 14:21:25' ORDER BY d ASC LIMIT 3;
9696
SELECT id, d FROM tsts WHERE t @@ 'wr&qh' AND d >= '2016-05-16 14:21:25' ORDER BY d DESC LIMIT 3;
9797

98+
-- Test "ORDER BY" error message
99+
DROP INDEX tsts_idx;
100+
101+
RESET enable_indexscan;
102+
RESET enable_indexonlyscan;
103+
RESET enable_bitmapscan;
104+
RESET enable_seqscan;
105+
106+
CREATE INDEX tsts_idx ON tsts USING rum (t rum_tsvector_addon_ops, d);
107+
108+
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;
109+
98110
-- Test multicolumn index
99111

100112
RESET enable_indexscan;

0 commit comments

Comments
 (0)