From: | Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> |
---|---|
To: | Juan Pablo Cook <juampick(at)gmail(dot)com> |
Cc: | pgsql-es-ayuda(at)postgresql(dot)org |
Subject: | Re: Duda FK |
Date: | 2009-07-02 19:10:44 |
Message-ID: | 20090702191044.GH4698@alvh.no-ip.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-es-ayuda |
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)
From | Date | Subject | |
---|---|---|---|
Next Message | Marcos Ortiz Valmaseda | 2009-07-02 19:25:00 | Re: Muchas tablas en BD |
Previous Message | juan | 2009-07-02 18:41:15 | Re: PostgreSQL 8.4 ha sido liberado, honor a quién honor merece |