PARTIAL, DEFERRABLE UNIQUE CONSTRAINTS

From: Daniel Migowski <dmigowski(at)ikoffice(dot)de>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: PARTIAL, DEFERRABLE UNIQUE CONSTRAINTS
Date: 2014-09-10 13:20:58
Message-ID: 41ED3F5450C90F4D8381BC4D8DF6BBDC7A4F39D6@EXCHANGESERVER.ikoffice.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello,

I need to create a deferrable,unique partial constraint (using a WHERE clause) on my table, which in addition should also be deferrable. AFAIK deferrable constraints are just creatable with

ALTER TABLE demand ADD CONSTRAINT unique_salesorderitem_id
UNIQUE (salesorderitem_id) DEFERRABLE INITIALLY DEFERRED;

but here I miss the WHERE clause. Using the CREATE INDEX notation like this:

CREATE UNIQUE INDEX idx_demand_salesorderitem_id_of_parentdemands
ON demand(salesorderitem_id) WHERE parentdemand_id IS NULL;

I cannot specify the deferability (is that a word?). I am Using PostgreSQL 9.1. Is there any way around this?

Regards,
Daniel Migowski

Responses

Browse pgsql-general by date

  From Date Subject
Next Message John DeSoi 2014-09-10 13:25:14 Re: Async IO HTTP server frontend for PostgreSQL
Previous Message Ramesh T 2014-09-10 09:52:52 Re: stackbuilder