BUG REPORT: GiST - default operator type for boolean - Mailing list pgsql-bugs

From James Pittman
Subject BUG REPORT: GiST - default operator type for boolean
Date
Msg-id 545A3E99.7020800@travelaudience.com
Whole thread Raw
List pgsql-bugs
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 =3D)

);


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 =3D)

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

pgsql-bugs by date:

Previous
From: James Pittman
Date:
Subject: BUG REPORT: Unable to cast boolean::smallint
Next
From: Tom Lane
Date:
Subject: Re: BUG REPORT: Unable to cast boolean::smallint