mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-21 08:29:39 +08:00
f7946a92b6
This will allow enums to be used in exclusion constraints. The code uses the new CallerFInfoFunctionCall infrastructure in fmgr, and the support for it added to btree_gist in commit 393bb504d7. Reviewed by Tom Lane and Anastasia Lubennikova Discussion: http://postgr.es/m/56EA8A71.8060107@dunslane.net
39 lines
927 B
SQL
39 lines
927 B
SQL
-- enum check
|
|
|
|
create type rainbow as enum ('r','o','y','g','b','i','v');
|
|
|
|
CREATE TABLE enumtmp (a rainbow);
|
|
|
|
\copy enumtmp from 'data/enum.data'
|
|
|
|
SET enable_seqscan=on;
|
|
|
|
select a, count(*) from enumtmp group by a order by 1;
|
|
|
|
SELECT count(*) FROM enumtmp WHERE a < 'g'::rainbow;
|
|
|
|
SELECT count(*) FROM enumtmp WHERE a <= 'g'::rainbow;
|
|
|
|
SELECT count(*) FROM enumtmp WHERE a = 'g'::rainbow;
|
|
|
|
SELECT count(*) FROM enumtmp WHERE a >= 'g'::rainbow;
|
|
|
|
SELECT count(*) FROM enumtmp WHERE a > 'g'::rainbow;
|
|
|
|
CREATE INDEX enumidx ON enumtmp USING gist ( a );
|
|
|
|
SET enable_seqscan=off;
|
|
|
|
SELECT count(*) FROM enumtmp WHERE a < 'g'::rainbow;
|
|
|
|
SELECT count(*) FROM enumtmp WHERE a <= 'g'::rainbow;
|
|
|
|
SELECT count(*) FROM enumtmp WHERE a = 'g'::rainbow;
|
|
|
|
SELECT count(*) FROM enumtmp WHERE a >= 'g'::rainbow;
|
|
|
|
SELECT count(*) FROM enumtmp WHERE a > 'g'::rainbow;
|
|
|
|
EXPLAIN (COSTS OFF)
|
|
SELECT count(*) FROM enumtmp WHERE a >= 'g'::rainbow;
|