Re: Problema con DEFERRED CONSTRAINTS

From: Miguel Rodríguez Penabad <penabad(at)gmail(dot)com>
To: Alberto <alberto(at)c17(dot)net>
Cc: pgsql-es-ayuda(at)postgresql(dot)org
Subject: Re: Problema con DEFERRED CONSTRAINTS
Date: 2007-06-06 15:09:24
Message-ID: 95335e4e0706060809o79e6a56exe47f6bd528de4082@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

> peticiones_articulos_fk -> FOREIGN KEY (articulo_id) REFERENCES
> articulos(id) ON UPDATE RESTRICT ON DELETE RESTRICT DEFERRABLE INITIALLY
> DEFERRED
>
> ¿No se supone que al estar la restricción declarada como INITIALLY
> DEFERRED no comprueba las restricciones hasta que termina la transacción?
>

Según la documentación, la acción referencial...
NO ACTION:
Produce an error indicating that the deletion or update would
create a foreign key constraint violation. If the constraint is
deferred, this error will be produced at constraint check time if
there still exist any referencing rows. This is the default action.

RESTRICT: Produce an error indicating that the deletion or update
would create a foreign key constraint violation. This is the same as
NO ACTION except that the check is not deferrable.

Es decir, que si cambias el restrict por no action te funciona como quieres.
Curioso el comportamiento, de todas formas :)

Saludos
--
Miguel

In response to

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Diego Ayala 2007-06-06 18:34:00 conectar base de datos PostgreSQL con Oracle
Previous Message Alvaro Herrera 2007-06-06 12:55:20 Re: Logs de PostgreSQL