Re: Default operator class for data type boolean for access method gist is missing

From: Andreas Joseph Krogh <andreak(at)officenet(dot)no>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Default operator class for data type boolean for access method gist is missing
Date: 2014-03-23 10:10:36
Message-ID: OfficeNetEmail.2b9.8648e2b7c49ce986.144ee6b67a2@prod2
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

På søndag 23. mars 2014 kl. 09:59:27, skrev Andreas Kretschmer <
akretschmer(at)spamfence(dot)net <mailto:akretschmer(at)spamfence(dot)net>>: Andreas Joseph
Krogh <andreak(at)officenet(dot)no> wrote:

> I'm trying to define the following exclusion-constraint
>  
>
> alter table my_table add EXCLUDE USING gist (is_default WITH =,
daterange(valid_from, valid_to, '[)') WITH &&) WHERE (is_default = true);
>
>  
> But it fails with:
> ERROR:  data type boolean 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.
>  
> I have the btree_gist extension installed.
>  
> So, my question is; Is there an existing operator-class I can install to
make
> this work, and if not - how do I make it?

CAST is to int?

test=# create table xx(b bool, tr tsrange, exclude using gist(b with =, tr
with &&));
ERROR:  data type boolean 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.
Time: 3,160 ms
test=*# create table xx(b bool, tr tsrange, exclude using gist((b::int) with
=, tr with &&));
CREATE TABLE
Time: 3,621 ms   Nice workaround, thanks.   --
Andreas Joseph Krogh <andreak(at)officenet(dot)no>      mob: +47 909 56 963
Senior Software Developer / CTO - OfficeNet AS - http://www.officenet.no
Public key: http://home.officenet.no/~andreak/public_key.asc  

In response to

Browse pgsql-general by date

  From Date Subject
Next Message jared 2014-03-23 15:19:11 plpython timestamp without time zone, showing up as text instead of timestamp
Previous Message Andreas Joseph Krogh 2014-03-23 09:22:03 Re: Default operator class for data type boolean for access method gist is missing