EXCLUDE, Gist and integers

From: Ken Tanzer <ken(dot)tanzer(at)gmail(dot)com>
To: PG-General Mailing List <pgsql-general(at)postgresql(dot)org>
Subject: EXCLUDE, Gist and integers
Date: 2015-07-16 00:21:07
Message-ID: CAD3a31VZ548B0fbsfwurZftb37iZCejTe=6hbqDvfeL9z-Uqag@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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!

Ken

--
AGENCY Software
A Free Software data system
By and for non-profits
*http://agency-software.org/ <http://agency-software.org/>*
*https://agency-software.org/demo/client
<https://agency-software.org/demo/client>*
ken(dot)tanzer(at)agency-software(dot)org
(253) 245-3801

Subscribe to the mailing list
<agency-general-request(at)lists(dot)sourceforge(dot)net?body=subscribe> to
learn more about AGENCY or
follow the discussion.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2015-07-16 03:25:08 Re: utf8 encoding problem with plperlu
Previous Message Ronald Peterson 2015-07-15 19:31:35 Re: utf8 encoding problem with plperlu