1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-20 05:03:10 +03:00
Files
postgres/contrib/btree_gin/sql/text.sql
Tom Lane fc896821c4 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 <tgl@sss.pgh.pa.us>
Reviewed-by: Arseniy Mukhin <arseniy.mukhin.dev@gmail.com>
Discussion: https://postgr.es/m/262624.1738460652@sss.pgh.pa.us
2025-07-03 16:30:38 -04:00

25 lines
909 B
SQL

set enable_seqscan=off;
CREATE TABLE test_text (
i text
);
INSERT INTO test_text VALUES ('a'),('ab'),('abc'),('abb'),('axy'),('xyz');
CREATE INDEX idx_text ON test_text USING gin (i);
SELECT * FROM test_text WHERE i<'abc' ORDER BY i;
SELECT * FROM test_text WHERE i<='abc' ORDER BY i;
SELECT * FROM test_text WHERE i='abc' ORDER BY i;
SELECT * FROM test_text WHERE i>='abc' ORDER BY i;
SELECT * FROM test_text WHERE i>'abc' ORDER BY i;
explain (costs off)
SELECT * FROM test_text WHERE i<'abc'::name COLLATE "default" ORDER BY i;
SELECT * FROM test_text WHERE i<'abc'::name COLLATE "default" ORDER BY i;
SELECT * FROM test_text WHERE i<='abc'::name COLLATE "default" ORDER BY i;
SELECT * FROM test_text WHERE i='abc'::name COLLATE "default" ORDER BY i;
SELECT * FROM test_text WHERE i>='abc'::name COLLATE "default" ORDER BY i;
SELECT * FROM test_text WHERE i>'abc'::name COLLATE "default" ORDER BY i;