Juan Pablo Cook escribió:

> Esta persona me dijo que tendrían que crearse así:
> 
> ALTER TABLE accesorio
>   ADD CONSTRAINT fk_accesorio_marca FOREIGN KEY (marca)
>       REFERENCES marca (codigo) MATCH SIMPLE
>       ON UPDATE RESTRICT ON  DELETE RESTRICT;
> 
> Yo lo que leí es que:
> 
> NONE: no hacer nada.
> RESTRICT: no permitir.
> CASCADE: hacer en cascada.

¿Estás simplemente traduciendo las palabras, o estás leyendo la
documentación?  Dice claramente la diferencia entre NO ACTION y
RESTRICT:

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. 
http://www.postgresql.org/docs/8.4/static/sql-createtable.html

-- 
Alvaro Herrera                 http://www.amazon.com/gp/registry/DXLWNGRJD34J
Thou shalt study thy libraries and strive not to reinvent them without
cause, that thy code may be short and readable and thy days pleasant
and productive. (7th Commandment for C Programmers)
--
TIP 1: para suscribirte y desuscribirte, visita 
http://archives.postgresql.org/pgsql-es-ayuda

Responder a