PostgreSQL EXCLUDE USING error: Data type integer has no default operator class

From: Denver Timothy <denver(at)timothy(dot)io>
To: pgsql-general(at)postgresql(dot)org
Subject: PostgreSQL EXCLUDE USING error: Data type integer has no default operator class
Date: 2013-03-22 16:14:45
Message-ID: 0868D8C4-4E9F-46B2-81E4-5BEAED15CE73@timothy.io
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

In PostgreSQL 9.2.3 I am trying to create this simplified table:

CREATE TABLE test (
user_id INTEGER,
startend TSTZRANGE,
EXCLUDE USING gist (user_id WITH =, startend WITH &&)
);

But I get this error:

ERROR: data type integer 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.

The PostgreSQL docs use these this example, which does not work for me (http://www.postgresql.org/docs/9.2/static/rangetypes.html):

CREATE TABLE room_reservation (
room text,
during tsrange,
EXCLUDE USING gist (room WITH =, during WITH &&)
);
ERROR: data type integer 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.

And this one, which does not work for me either (http://www.postgresql.org/docs/9.2/static/btree-gist.html):

CREATE TABLE zoo (
cage INTEGER,
animal TEXT,
EXCLUDE USING gist (cage WITH =, animal WITH <>)
);
ERROR: data type text 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 am able to create this without any problem:

CREATE TABLE test (
user_id INTEGER,
startend TSTZRANGE,
EXCLUDE USING gist (startend WITH &&)
);

and this:

CREATE TABLE test (
user_id INTEGER,
startend TSTZRANGE,
EXCLUDE USING btree (user_id WITH =)
);

I've spent quite a bit of time searching for hints on figuring out how to make this work, or figuring out why it won't work. I've also been trying to understand CREATE OPERATOR and CREATE OPERATOR CLASS, but those are over my head for now. Could anyone point me in the right direction?

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Martín Marqués 2013-03-22 16:38:10 Re: Alphanumeric natural order sorting : need generic solution
Previous Message Alexander Farber 2013-03-22 15:52:16 Re: Re: Matching uppercased russian words (\x0410-\x042F) in UTF8 database 8.4.13