Re: PARTIAL, DEFERRABLE UNIQUE CONSTRAINTS

From: Daniel Migowski <dmigowski(at)ikoffice(dot)de>
To: David G Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: PARTIAL, DEFERRABLE UNIQUE CONSTRAINTS
Date: 2014-09-10 21:58:53
Message-ID: 41ED3F5450C90F4D8381BC4D8DF6BBDC7A4F3E6E@EXCHANGESERVER.ikoffice.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Works like a charm! Thank you very much, PostgreSQL really is an awesome database, and so is the community.

-----Ursprüngliche Nachricht-----
Von: pgsql-general-owner(at)postgresql(dot)org [mailto:pgsql-general-owner(at)postgresql(dot)org] Im Auftrag von David G Johnston
Gesendet: Mittwoch, 10. September 2014 15:45
An: pgsql-general(at)postgresql(dot)org
Betreff: Re: [GENERAL] PARTIAL, DEFERRABLE UNIQUE CONSTRAINTS

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.

--
Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org) To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

In response to

Browse pgsql-general by date

  From Date Subject
Next Message John DeSoi 2014-09-11 00:38:46 Re: Async IO HTTP server frontend for PostgreSQL
Previous Message Steve Crawford 2014-09-10 21:50:15 Re: PostgreSQL Portable