Re: pg_depend - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: pg_depend
Date
Msg-id Pine.LNX.4.30.0107171831430.678-100000@peter.localdomain
Whole thread Raw
In response to Re: pg_depend  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: pg_depend
List pgsql-hackers
Bruce Momjian writes:

> Is it?  Are we going to record dependency both ways, e.g primary table
> -> foreign table and foreign table -> primary table, or just one of
> them.  And when we see we depend on something, do we know always what it
> could be.  If I drop a table and I depend on oid XXX, do I know if that
> is a type, function, or serial sequence?

When you drop a table, there are only so many things that could depend on
it:

* rules/views
* triggers
* check constraints
* foreign key constraints
* primary key constraints
* unique constraints
* subtables

including their dependencies.  There might be others I forgot but a
finite list can be defined.

When a table is dropped, you scan all of these objects (their system
catalogs) for matches against the table and either do a cascade or
restrict.  This is not new, we already do this for indexes and
descriptions, for instance.

-- 
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: SIGCHLD handler in Postgres C function.
Next
From: Tom Lane
Date:
Subject: Re: pg_depend