PARTIAL, DEFERRABLE UNIQUE CONSTRAINTS - Mailing list pgsql-general

From Daniel Migowski
Subject PARTIAL, DEFERRABLE UNIQUE CONSTRAINTS
Date
Msg-id 41ED3F5450C90F4D8381BC4D8DF6BBDC7A4F39D6@EXCHANGESERVER.ikoffice.de
Whole thread Raw
Responses Re: PARTIAL, DEFERRABLE UNIQUE CONSTRAINTS
List 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

pgsql-general by date:

Previous
From: "McGehee, Robert"
Date:
Subject: Aggregating over nodes in hierarchical trees
Next
From: John DeSoi
Date:
Subject: Re: Async IO HTTP server frontend for PostgreSQL