Skip to content

Commit

Permalink
[PGPRO-11393] Added test for "ORDER BY" error message
Browse files Browse the repository at this point in the history
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
  • Loading branch information
arseny114 committed Nov 11, 2024
1 parent 53948ec commit 6fecdf7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions expected/orderby.out
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,11 @@ SELECT id, d FROM tsts WHERE t @@ 'wr&qh' AND d >= '2016-05-16 14:21:25' ORDER
458 | Fri May 20 21:21:22.326724 2016
(3 rows)

-- Test "ORDER BY" error message
DROP INDEX tsts_idx;
CREATE INDEX tsts_idx ON tsts USING rum (t rum_tsvector_addon_ops, d);
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;
ERROR: cannot order without attribute 2 in ORDER BY clause
-- Test multicolumn index
RESET enable_indexscan;
RESET enable_indexonlyscan;
Expand Down
7 changes: 7 additions & 0 deletions sql/orderby.sql
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@ SELECT id, d FROM tsts WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER
SELECT id, d FROM tsts WHERE t @@ 'wr&qh' AND d >= '2016-05-16 14:21:25' ORDER BY d ASC LIMIT 3;
SELECT id, d FROM tsts WHERE t @@ 'wr&qh' AND d >= '2016-05-16 14:21:25' ORDER BY d DESC LIMIT 3;

-- Test "ORDER BY" error message
DROP INDEX tsts_idx;

CREATE INDEX tsts_idx ON tsts USING rum (t rum_tsvector_addon_ops, d);

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;

-- Test multicolumn index

RESET enable_indexscan;
Expand Down

0 comments on commit 6fecdf7

Please sign in to comment.