Re: BUG #1740: Deferred foreign key constraint isn't deferred

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Daniel Cristian Cruz <dccruz(at)mega(dot)com(dot)br>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #1740: Deferred foreign key constraint isn't deferred
Date: 2005-06-30 17:24:03
Message-ID: 20050630102136.G34918@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


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.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2005-06-30 21:35:16 Re: BUG #1741: %i missing in snprintf implementation
Previous Message Tim Mauch 2005-06-30 16:18:58 BUG #1741: %i missing in snprintf implementation