From: | jsgarcia(at)seguridad(dot)unam(dot)mx |
---|---|
To: | pgsql-es-ayuda(at)postgresql(dot)org |
Subject: | Borrar registro con FK |
Date: | 2009-06-15 23:47:44 |
Message-ID: | 20090615184744.iqsxgyav40www0wo@correo.seguridad.unam.mx |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-es-ayuda |
Buenas tardes,
En un blog que tenemos, para mostrar el último artículo, obtiene datos
de diferentes tablas (tres para ser exactos).
Esas tres tablas están relacionadas entre sí. La cuestión es que
necesito eliminar un registro que hice de prueba. Tengo que ir
eliminando tabla por tabla. LO que no encuentro es cómo borrar para
que no me salga el error:
ERROR: update or delete on table "tabla1" violates foreign key
constraint "$1" on table "tabla2"
DETAIL: Key (id)=(523) is still referenced from table "table2".
Yo entiendo que que así como así no se puede pues ese es uno de los
objetivos de crear las FK. He investigado y al parecer se hace con ON
DELETE CASCADE....aunque no entiendo si en verdad es así o cómo se
utiliza.
Gracias¡¡¡¡
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
Attachment | Content-Type | Size |
---|---|---|
Clave PGP =?iso-8859-1?b?cPpibGljYQ==?= | application/pgp-keys | 1.7 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | suso | 2009-06-16 00:08:00 | Re: Bloqueo en registro-tabla |
Previous Message | Mariano Reingart | 2009-06-15 23:05:47 | Re: Bloqueo en registro-tabla |