Re: dependency on columns basis

From: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org, salah jubeh <s_jubeh(at)yahoo(dot)com>
Subject: Re: dependency on columns basis
Date: 2011-08-22 15:06:16
Message-ID: 201108220806.17460.adrian.klaver@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Monday, August 22, 2011 7:47:47 am salah jubeh wrote:
> Hello,
>
> I have a lookup table I want to delete which is referenced as a foreign
> key in another table. Is there is a way to find all of the tables
> depends on this column (foreign key) but not the whole table or view.
>
>
> Thanks in advance

In psql:
\d referenced_table

Example:

test(5432)aklaver=>\d fk_1
Table "public.fk_1"
Column | Type | Modifiers
---------+-------------------+-----------
id | integer | not null
txt_fld | character varying |
Indexes:
"fk_1_pkey" PRIMARY KEY, btree (id)
Referenced by:
TABLE "fk_2" CONSTRAINT "fk_2_id2_fkey" FOREIGN KEY (id2) REFERENCES
fk_1(id) ON DELETE CASCADE

--
Adrian Klaver
adrian(dot)klaver(at)gmail(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Kevin Grittner 2011-08-22 15:17:57 Re: help in postgresql
Previous Message salah jubeh 2011-08-22 14:47:47 dependency on columns basis