Pergunta

can anyone explain to me why the execution of "DISABLE PRIMARY KEY CASCADE" on a PK doesn't set the corresponding unique (!) index to unusable?

As far as I know the CASCADE option should do exactly that... However, I observed differently on several occasions.

Hope some of you can help.

best regards, daZza

Foi útil?

Solução

The cascade option disables constraints that are dependent on this one, such as foreign keys dependent on a primary or unique constraint.

A unique index is not a constraint, although it acts as one.

In general I would advise that you create non-unique indexes to support a primary or unique key, not a unique index, for precisely this reason, and to allow constraints to be deferrable, or entirely dropped and recreated without having to recreate the index.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top