Files
Tom Lane e74f7a5a34 Add more cross-type comparisons to contrib/btree_gin.
Using the just-added infrastructure, extend btree_gin to support
cross-type operators in its other opclasses.  All of the cross-type
comparison operators supported by the core btree opclasses for
these datatypes are now available for btree_gin indexes as well.

Author: Tom Lane <[email protected]>
Reviewed-by: Arseniy Mukhin <[email protected]>
Discussion: https://postgr.es/m/[email protected]
2025-07-03 16:30:38 -04:00

33 lines
1.2 KiB
SQL

set enable_seqscan=off;
CREATE TABLE test_name (
i name
);
INSERT INTO test_name VALUES ('a'),('ab'),('abc'),('abb'),('axy'),('xyz');
CREATE INDEX idx_name ON test_name USING gin (i);
SELECT * FROM test_name WHERE i<'abc' ORDER BY i;
SELECT * FROM test_name WHERE i<='abc' ORDER BY i;
SELECT * FROM test_name WHERE i='abc' ORDER BY i;
SELECT * FROM test_name WHERE i>='abc' ORDER BY i;
SELECT * FROM test_name WHERE i>'abc' ORDER BY i;
EXPLAIN (COSTS OFF) SELECT * FROM test_name WHERE i<'abc' ORDER BY i;
EXPLAIN (COSTS OFF) SELECT * FROM test_name WHERE i<='abc' ORDER BY i;
EXPLAIN (COSTS OFF) SELECT * FROM test_name WHERE i='abc' ORDER BY i;
EXPLAIN (COSTS OFF) SELECT * FROM test_name WHERE i>='abc' ORDER BY i;
EXPLAIN (COSTS OFF) SELECT * FROM test_name WHERE i>'abc' ORDER BY i;
explain (costs off)
SELECT * FROM test_name WHERE i<'abc'::text ORDER BY i;
SELECT * FROM test_name WHERE i<'abc'::text ORDER BY i;
SELECT * FROM test_name WHERE i<='abc'::text ORDER BY i;
SELECT * FROM test_name WHERE i='abc'::text ORDER BY i;
SELECT * FROM test_name WHERE i>='abc'::text ORDER BY i;
SELECT * FROM test_name WHERE i>'abc'::text ORDER BY i;
SELECT * FROM test_name WHERE i<=repeat('abc', 100) ORDER BY i;