@@ -42,6 +42,42 @@ SELECT * FROM test_int8 WHERE i>1::int8 ORDER BY i;
4242 3
4343(2 rows)
4444
45+ EXPLAIN (costs off)
46+ SELECT *, i <=> 0::int8 FROM test_int8 ORDER BY i <=> 0::int8;
47+ QUERY PLAN
48+ ----------------------------------------
49+ Index Scan using idx_int8 on test_int8
50+ Order By: (i <=> '0'::bigint)
51+ (2 rows)
52+
53+ SELECT *, i <=> 0::int8 FROM test_int8 ORDER BY i <=> 0::int8;
54+ i | ?column?
55+ ----+----------
56+ 0 | 0
57+ -1 | 1
58+ 1 | 1
59+ -2 | 2
60+ 2 | 2
61+ 3 | 3
62+ (6 rows)
63+
64+ EXPLAIN (costs off)
65+ SELECT *, i <=> 1::int8 FROM test_int8 WHERE i<1::int8 ORDER BY i <=> 1::int8;
66+ QUERY PLAN
67+ ----------------------------------------
68+ Index Scan using idx_int8 on test_int8
69+ Index Cond: (i < '1'::bigint)
70+ Order By: (i <=> '1'::bigint)
71+ (3 rows)
72+
73+ SELECT *, i <=> 1::int8 FROM test_int8 WHERE i<1::int8 ORDER BY i <=> 1::int8;
74+ i | ?column?
75+ ----+----------
76+ 0 | 1
77+ -1 | 2
78+ -2 | 3
79+ (3 rows)
80+
4581CREATE TABLE test_int8_o AS SELECT id::int8, t FROM tsts;
4682CREATE INDEX test_int8_o_idx ON test_int8_o USING rum
4783 (t rum_tsvector_addon_ops, id)
@@ -648,3 +684,30 @@ SELECT id FROM test_int8_h_a WHERE t @@ 'wr&qh' AND id >= 400::int8 ORDER BY id
648684 496
649685(7 rows)
650686
687+ CREATE TABLE test_int8_id_t AS SELECT id::int8, t FROM tsts;
688+ CREATE INDEX test_int8_id_t_idx ON test_int8_o USING rum
689+ (t rum_tsvector_ops, id);
690+ EXPLAIN (costs off)
691+ SELECT id FROM test_int8_h_a WHERE t @@ 'wr&qh' AND id <= 400::int8 ORDER BY id <=> 400::int8;
692+ QUERY PLAN
693+ -----------------------------------------------------------------------------
694+ Index Scan using test_int8_h_a_idx on test_int8_h_a
695+ Index Cond: ((t @@ '''wr'' & ''qh'''::tsquery) AND (id <= '400'::bigint))
696+ Order By: (id <=> '400'::bigint)
697+ (3 rows)
698+
699+ SELECT id FROM test_int8_h_a WHERE t @@ 'wr&qh' AND id <= 400::int8 ORDER BY id <=> 400::int8;
700+ id
701+ -----
702+ 371
703+ 355
704+ 354
705+ 252
706+ 232
707+ 168
708+ 135
709+ 71
710+ 39
711+ 16
712+ (10 rows)
713+
0 commit comments