| From: | Richard Huxton <dev(at)archonet(dot)com> |
|---|---|
| To: | Jean-Christian Imbeault <jc(at)mega-bucks(dot)co(dot)jp>, Oliver Elphick <olly(at)lfix(dot)co(dot)uk> |
| Cc: | PostgreSQL general list <pgsql-general(at)postgresql(dot)org> |
| Subject: | Re: adding on delete cascade constraint? |
| Date: | 2003-09-19 13:52:59 |
| Message-ID: | 200309191452.59650.dev@archonet.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On Friday 19 September 2003 14:02, Jean-Christian Imbeault wrote:
> Oliver Elphick wrote:
> >>Foreign Key constraints: $1 FOREIGN KEY (pid) REFERENCES products(id) ON
> >>UPDATE NO ACTION ON DELETE NO ACTION
> >
> > Drop the constraint; then add an amended one.
>
> Ok, how do I drop the constraint, it has no name.
Its name is "$1" - use
DROP CONSTRAINT "$1" ...
> Secondly what is the correct syntax for adding a new constraint with ON
> DELETE CASCADE?
See the SQL command reference for ALTER TABLE. It's something like:
ALTER TABLE mytable ADD CONSTRAINT constraint_name FOREIGN KEY ... etc
--
Richard Huxton
Archonet Ltd
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Dennis Gearon | 2003-09-19 14:03:02 | An idea for IPU ( We need another acronymn! ) |
| Previous Message | Xavier Ambrosioni | 2003-09-19 13:42:09 | Access Ingres database |