Re: EXCLUDE, Gist and integers - Mailing list pgsql-general

From Guillaume Lelarge
Subject Re: EXCLUDE, Gist and integers
Date
Msg-id CAECtzeWjUgfZOLPGz9J5s-GBjam8DfKyFBPYNWx8OveCr5y8Zw@mail.gmail.com
Whole thread Raw
In response to EXCLUDE, Gist and integers  (Ken Tanzer <ken.tanzer@gmail.com>)
Responses Re: EXCLUDE, Gist and integers  (Ken Tanzer <ken.tanzer@gmail.com>)
List pgsql-general

Hi,

Le 16 juil. 2015 2:23 AM, "Ken Tanzer" <ken.tanzer@gmail.com> a écrit :
>
> Hi.  I'm looking into adding daterange exclusions to some of my tables.  Following the documentation, I can do this no problem to prevent any records from overlapping:
>
> CREATE TEMP TABLE foo (
>   client_id integer,
>   start_date date NOT NULL,
>   end_date date,
>   EXCLUDE using gist (daterange(start_date,end_date) with &&)
> );
>
> But what I really want is no overlapping records on a per-client basis.  I optimistically tried this:
>
> CREATE TEMP TABLE foo (
>   client_id integer,
>   start_date date NOT NULL,
>   end_date date,
>   EXCLUDE using gist (daterange(start_date,end_date) with &&,client_id with =)
> );
>
> But Postgres responds thusly:
>
> 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.
>
> Can someone tell me what's the easiest way to make this work?  Thanks in advance!
>

You should install the btree_gist extension.

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: utf8 encoding problem with plperlu
Next
From: Ken Tanzer
Date:
Subject: Re: EXCLUDE, Gist and integers