2

Following in the style of this, I'm trying to create an exclusion constraint over an ENUM,

CREATE TYPE dow AS ENUM (
  'Monday', 'Tuesday', 'Wednesday', 'Thursday',
  'Friday', 'Saturday', 'Sunday'
);

CREATE TABLE available (
  dow      dow,
  tsrange  tsrange,
  EXCLUDE USING gist (tsrange WITH =, dow WITH &&)
);

Returns

ERROR:  data type dow has no default operator class for access method "gist"
HINT:  You must specify an operator class for the index or define a default operator class for the data type.
0

This is apparently a known issue, and it was fixed in PostgreSQL 10. The new version of btree_gist (10+) has in the docs,

btree_gist provides GiST index operator classes that implement B-tree equivalent behavior for the data types int2, int4, int8, float4, float8, numeric, timestamp with time zone, timestamp without time zone, time with time zone, time without time zone, date, interval, oid, money, char, varchar, text, bytea, bit, varbit, macaddr, macaddr8, inet, cidr, uuid, and all enum types.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.