Обсуждение: viewing/altering the "ON DELETE CASCADE" constraint

Поиск
Список
Период
Сортировка

viewing/altering the "ON DELETE CASCADE" constraint

От
Jon Lapham
Дата:
Hello All-

I'm sure this is a FAQ, but I cannot find anything in the docs that
directly addresses this.

How can I determine if a column 1) has a foreign key constraint, and 2)
if that fkey constraint includes "ON DELETE CASCADE"?  I've tried the
various "\d"-type commands in psql to no avail.

Finally, assuming you have a column that *has* a fkey constraint, but
not the additional "ON DELETE CASCADE" portion, how would you go about
adding "ON DELETE CASCADE" to the column?

TIA,
-Jon

PS: PostgreSQL v7.2.1

PSS: I'm happy to receive a RTFM, if you would be so kind as to also
point to where in the FM these things might be...

PSSS: Searching the mailing lists on http://archives.postgresql.org/ is
returning an error message: could not connect to server: Connection
refused Is the server running on host db.postgresql.org and accepting
TCP/IP connections on port 5433?

--

-**-*-*---*-*---*-*---*-----*-*-----*---*-*---*-----*-----*-*-----*---
  Jon Lapham
  Extracta Moléculas Naturais, Rio de Janeiro, Brasil
  email: lapham@extracta.com.br      web: http://www.extracta.com.br/
***-*--*----*-------*------------*--------------------*---------------


Re: viewing/altering the "ON DELETE CASCADE" constraint

От
Stephan Szabo
Дата:
On Mon, 22 Jul 2002, Jon Lapham wrote:

> Hello All-
>
> I'm sure this is a FAQ, but I cannot find anything in the docs that
> directly addresses this.
>
> How can I determine if a column 1) has a foreign key constraint, and 2)
> if that fkey constraint includes "ON DELETE CASCADE"?  I've tried the
> various "\d"-type commands in psql to no avail.
>
> Finally, assuming you have a column that *has* a fkey constraint, but
> not the additional "ON DELETE CASCADE" portion, how would you go about
> adding "ON DELETE CASCADE" to the column?

The best place to get info on this is at
http://techdocs.postgresql.org/

There are a few things on referential integrity there that I believe
describe how to get the info on the constraints.  As for changing
the constraint, you'll probably need to drop the constraint (dropping
the triggers) and then add it with alter table add constraint probably.


Re: viewing/altering the "ON DELETE CASCADE" constraint

От
Jon Lapham
Дата:
Stephan Szabo wrote:
> On Mon, 22 Jul 2002, Jon Lapham wrote:
>>How can I determine if a column 1) has a foreign key constraint, and 2)
>>if that fkey constraint includes "ON DELETE CASCADE"?  I've tried the
>>various "\d"-type commands in psql to no avail.
>>
>>Finally, assuming you have a column that *has* a fkey constraint, but
>>not the additional "ON DELETE CASCADE" portion, how would you go about
>>adding "ON DELETE CASCADE" to the column?
>
>
> The best place to get info on this is at
> http://techdocs.postgresql.org/
>

Yup, thanks Stephan.  I've never seen this site, it looks like there is
a lot of good info there.

Joel Burton's "Hacking Referential Integrity & Hacking the Referential
Integrity Tables" has everything I needed.

http://techdocs.postgresql.org/techdocs/hackingreferentialintegrity.php

-Jon

--

-**-*-*---*-*---*-*---*-----*-*-----*---*-*---*-----*-----*-*-----*---
  Jon Lapham
  Extracta Moléculas Naturais, Rio de Janeiro, Brasil
  email: lapham@extracta.com.br      web: http://www.extracta.com.br/
***-*--*----*-------*------------*--------------------*---------------