Comment 2 for bug 1569884

Revision history for this message
Mike Rylander (mrylander) wrote :

Steve,

That is close, but will stop one from deleting two parts with the same label. You're proposal in the description is actually closer, but can't be done with a CONSTRAINT directly. Instead, we need a partial unique index. Something like:

ALTER TABLE biblio.monograph_part DROP CONSTRAINT "record_label_unique";
CREATE INDEX CONCURRENTLY record_label_unique_idx ON biblio.monograph_part (record, label) WHERE deleted = FALSE;