Re: adding on delete cascade constraint? - Mailing list pgsql-general

From Jean-Christian Imbeault
Subject Re: adding on delete cascade constraint?
Date
Msg-id 3F6AFE62.1030709@mega-bucks.co.jp
Whole thread Raw
In response to Re: adding on delete cascade constraint?  (Oliver Elphick <olly@lfix.co.uk>)
Responses Re: adding on delete cascade constraint?  (Oliver Elphick <olly@lfix.co.uk>)
Re: adding on delete cascade constraint?  (Richard Huxton <dev@archonet.com>)
List pgsql-general
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.

The documentation is rather poor on how to get the name of unamed
constraints:

"To remove a constraint you need to know its name. If you gave it a name
then that's easy. Otherwise the system assigned a generated name, which
you need to find out. The psql command \d tablename can be helpful here"

Secondly what is the correct syntax for adding a new constraint with ON
DELETE CASCADE?

Thanks,

Jean-Christian Imbeault



pgsql-general by date:

Previous
From: Daniel Schuchardt
Date:
Subject: Re: psql and blob
Next
From: Martin Marques
Date:
Subject: Re: PostgreSQL versus MySQL