| 1 |
set enable_seqscan=off; |
| 2 |
|
| 3 |
CREATE TYPE rainbow AS ENUM ('r','o','y','g','b','i','v'); |
| 4 |
|
| 5 |
CREATE TABLE test_enum ( |
| 6 |
i rainbow |
| 7 |
); |
| 8 |
|
| 9 |
INSERT INTO test_enum VALUES ('v'),('y'),('r'),('g'),('o'),('i'),('b'); |
| 10 |
|
| 11 |
CREATE INDEX idx_enum ON test_enum USING gin (i); |
| 12 |
|
| 13 |
SELECT * FROM test_enum WHERE i<'g'::rainbow ORDER BY i; |
| 14 |
SELECT * FROM test_enum WHERE i<='g'::rainbow ORDER BY i; |
| 15 |
SELECT * FROM test_enum WHERE i='g'::rainbow ORDER BY i; |
| 16 |
SELECT * FROM test_enum WHERE i>='g'::rainbow ORDER BY i; |
| 17 |
SELECT * FROM test_enum WHERE i>'g'::rainbow ORDER BY i; |
| 18 |
|
| 19 |
explain (costs off) SELECT * FROM test_enum WHERE i>='g'::rainbow ORDER BY i; |
| 20 |
|
| 21 |
|
| 22 |
-- make sure we handle the non-evenly-numbered oid case for enums |
| 23 |
create type e as enum ('0', '2', '3'); |
| 24 |
alter type e add value '1' after '0'; |
| 25 |
create table t as select (i % 4)::text::e from generate_series(0, 100000) as i; |
| 26 |
create index on t using gin (e); |