array exclusion constraint

From: Philip Taylor <philiptaylor51(at)yahoo(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: array exclusion constraint
Date: 2012-11-17 18:05:40
Message-ID: 1353175540.79593.YahooMailNeo@web160102.mail.bf1.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

CREATE TABLE foo (
   x CHAR(32) PRIMARY KEY,
   y CHAR(32) NOT NULL,
   EXCLUDE USING gist ((ARRAY[x, y]) WITH &&)
);

ERROR:  data type character[] 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.

Neither gist nor gin work. You can do that with integers using the intarray extension module.
Could you please suggest me a clean way to achieve the same result (using the char data type, not integers)?
Probably I could create a specific operator class or some other workaround, but the intarray implementation looks a bit complex.
Someone so kind to point me in the right direction?

Of course the following produces the same error:

CREATE TABLE bar (
   x VARCHAR[] NOT NULL,
   EXCLUDE USING gist (x WITH &&)
);

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Noah Misch 2012-11-17 18:25:07 Re: foreign key locks
Previous Message Karl O. Pinc 2012-11-17 18:02:46 Re: Add big fat caution to pg_restore docs regards partial db restores