dependency on columns basis

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

dependency on columns basis

От:
salah jubeh <s_jubeh@yahoo.com>
Дата:
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

Re: dependency on columns basis

От:
Adrian Klaver <adrian.klaver@gmail.com>
Дата:
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.klaver@gmail.com
FAQ