PostgreSQL EXCLUDE USING error: Data type integer has no default operator class - Mailing list pgsql-general

From Denver Timothy
Subject PostgreSQL EXCLUDE USING error: Data type integer has no default operator class
Date
Msg-id 0868D8C4-4E9F-46B2-81E4-5BEAED15CE73@timothy.io
Whole thread Raw
Responses Re: PostgreSQL EXCLUDE USING error: Data type integer has no default operator class
List 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.
Couldanyone point me in the right direction? 

pgsql-general by date:

Previous
From: Misa Simic
Date:
Subject: Re: How to join table to itself N times?
Next
From: Ryan Kelly
Date:
Subject: Re: PostgreSQL EXCLUDE USING error: Data type integer has no default operator class