Обсуждение: how to get dependancies of a table?
I want to delete a table and get the message ERROR: cannot drop table dummyblabla because other objects depend on it HINT: Use DROP ... CASCADE to drop the dependent objects too. Cascading is a little bit risky so I want to avoid that. Instead I would prefer to see the dependancies. I have no idea where to look. Any hints or ideas?
nobs@nobswolf.info (Emil Obermayr) writes:
> Instead I would prefer to see the dependancies. I have no idea where to
> look.
Fix whatever client you're using to not throw away NOTICE messages ...
regression=# create table foo (f1 int primary key);
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "foo_pkey" for table "foo"
CREATE TABLE
regression=# create table bar (d1 int references foo);
CREATE TABLE
regression=# create table baz (d1 int references foo);
CREATE TABLE
regression=# drop table foo;
NOTICE: constraint baz_d1_fkey on table baz depends on table foo
NOTICE: constraint bar_d1_fkey on table bar depends on table foo
ERROR: cannot drop table foo because other objects depend on it
HINT: Use DROP ... CASCADE to drop the dependent objects too.
regards, tom lane
On Mon, Jul 07, 2008 at 10:07:59AM -0400, Tom Lane wrote: > > Fix whatever client you're using to not throw away NOTICE messages ... Which client do you recommend for XP? I tried Phppgadmin and Navicat with same (missing NOTICE) result. I sent reports to both, Navicat promised to fix; no answer from Phppgadmin so far. Is there a dummie-howto about pg_depend or such for that purpose? Emil