Re: PARTIAL, DEFERRABLE UNIQUE CONSTRAINTS

From: David G Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: PARTIAL, DEFERRABLE UNIQUE CONSTRAINTS
Date: 2014-09-10 13:45:21
Message-ID: 1410356721382-5818445.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

dmigowski wrote
> I need to create a deferrable,unique partial constraint (using a WHERE
> clause) on my table

I don't know the exact required syntax but the description of the "EXCLUDE"
clause to "CREATE TABLE" implies that it can be used to accomplish what you
desire.

Not tested but something like:

EXCLUDE USING btree ( col WITH = ) WHERE ... DEFERRABLE INITIALLY IMMEDIATE

http://www.postgresql.org/docs/9.1/static/sql-createtable.html

While the documentation says that using btree with EXCLUDE is uncommon this
does seem to be a mandatory exception.

David J.

--
View this message in context: http://postgresql.1045698.n5.nabble.com/PARTIAL-DEFERRABLE-UNIQUE-CONSTRAINTS-tp5818441p5818445.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Vinayak 2014-09-10 13:50:33 CREATE SYNONYM in PostgreSQL
Previous Message John DeSoi 2014-09-10 13:25:14 Re: Async IO HTTP server frontend for PostgreSQL