Exclusion Constraints on Arrays?

From: "David E(dot) Wheeler" <david(at)justatheory(dot)com>
To: Pg Hackers <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Exclusion Constraints on Arrays?
Date: 2012-05-13 04:12:11
Message-ID: C7E9B9D1-40B5-4E34-958F-C2E58517AEB2@justatheory.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hackers,

I need a constraint that ensures that a text[] column has only unique values -- that is, that there is no overlap of values between rows. I thought this was a made-to-order for an exclusion constraint. So I tried it:

david=# create table tags (names text[] primary key, exclude using gist (names WITH &&));NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "tags_pkey" for table "tags"
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.

Rats! It looks like there is only a gin operator family for arrays, not gist, and exclusion constraints support only gist indexes, and I couldn't find an operator class, either. Have I missed something, in my (likely) ignorance? Or are there perhaps some types to consider modifying to support exclusion constraints?

Thanks,

David

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2012-05-13 04:37:52 Re: Draft release notes complete
Previous Message Bruce Momjian 2012-05-13 02:35:21 Re: Credit in the release notes WAS: Draft release notes complete