BUG REPORT: GiST - default operator type for boolean

Started by James Pittmanover 11 years ago1 messagesbugs
Jump to latest
#1James Pittman
j.pittman@travelaudience.com

Apologies if this is more of a 'feature request' than a bug. I thought
I'd repeat it as it seems an unusual missing feature.

With btree_gist it does not apepar possible to use the equals constraint
with a boolean type.

Therefore this (slightly contrived) example fails:

CREATE TABLE meetings_calendar (
id serial,
firstname varchar NOT NULL,
meeting_time daterange NOT NULL,
is_alternative_schedule boolean NOT NULL,
PRIMARY KEY (id),
CONSTRAINT no_time_overlap_except_alternative
EXCLUDE USING gist
(meeting_time WITH &&, is_alternative_schedule WITH =)

);

ERROR: data type boolean has no default operator class for access
method "gist"

My workaround is to recast the boolean to an integer in the constraint
itself.

CONSTRAINT no_time_overlap_except_alternative
EXCLUDE USING gist
(meeting_time WITH &&, (is_alternative_schedule::int) WITH =)

This however, only works with btree_gist - unexpended GiST does not have
a default operator for integers either.

Therefore it might be worth considering this as a feature enhancement.
Apologies if this is already on the TODO list. The GiST documentation
was quite weighty and it did not seem obvious if this has been discussed.

Eitherway, I hope this request is of assistance

Kind regards,

James