On Thu, 30 Jun 2005, Daniel Cristian Cruz wrote: > ALTER TABLE ONLY mat_comissao_itens > ADD CONSTRAINT mat_nf_saida_itens_pa_mat_comissao_itens FOREIGN KEY > (mat_nfs_diretorio, mat_nfs_in_codigo, mat_nsi_in_ordem) REFERENCES > mat_nf_saida_itens(mat_nfs_diretorio, mat_nfs_in_codigo, mat_nsi_in_ordem) > ON UPDATE RESTRICT ON DELETE RESTRICT DEFERRABLE INITIALLY DEFERRED; > > BEGIN; > DELETE FROM mat_nf_saida_itens WHERE mat_nsi_in_ordem = 2; > UPDATE mat_comissao_itens SET mat_nsi_in_ordem = 1 WHERE mat_nsi_in_ordem = > 2; > COMMIT;
Referential actions are immediate (they're defined as actions that happen upon the occurrance), it's the constraint checks that are deferrable with the deferrable/initially deferred. ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match