Thread: Completed pg_depend support

Completed pg_depend support

From
Rod Taylor
Date:
Tracks most inter system table dependencies.

With a small amount of work, allows dropping sequences with the table in
the event of a serial type.  Restricting (cascading) through foreign
keys, and functional RESTRICT / CASCADE behaviour to most items.

Doesn't allow DROP USER CASCADE, nor does it track comments.  A few
tables like opclass, and am/amop are not tracked either simply because I
really don't know what they do and how the user can affect them.


Rather large regression tests will be started with RESTRICT / CASCADE
behaviours after this portion is committed.  Tired of getting a large
number of conflicts every couple days with Toms namespace work.

New tricks?  Check out heap_drop_with_catalog.  You'll notice the
relation type, indicies, view rules are handled by dependDelete().

Also, try to drop type int4 ;)  Restricts by default (fresh initdb).

template1=# drop type int4;
ERROR:  Drop Restricted as Table pg_inherits Depends on Type int4

TODO.depend is the list of actions I needed to do (or did).  More or
gives a list of affected areas.


Dependencies still to do are in precompiled copies of functions,
defaults, and rule contents.  I have no clues how to do those items.


Attachment

Re: Completed pg_depend support

From
"Christopher Kings-Lynne"
Date:
> Also, try to drop type int4 ;)  Restricts by default (fresh initdb).
>
> template1=# drop type int4;
> ERROR:  Drop Restricted as Table pg_inherits Depends on Type int4
>
> TODO.depend is the list of actions I needed to do (or did).  More or
> gives a list of affected areas.

Do superusers have more privileges than normal users?  ie. Does it say
prevent normal users from doing hideous stuff like dropping int4, but allows
a superuser to do it if they really want to?

Chris



Re: Completed pg_depend support

From
"Rod Taylor"
Date:
The CASCADE behaviour will allow it to be dropped -- no matter what
(to a point).
--
Rod Taylor

Your eyes are weary from staring at the CRT. You feel sleepy. Notice
how restful it is to watch the cursor blink. Close your eyes. The
opinions stated above are yours. You cannot imagine why you ever felt
otherwise.

----- Original Message -----
From: "Christopher Kings-Lynne" <chriskl@familyhealth.com.au>
To: "Rod Taylor" <rbt@zort.ca>; <pgsql-patches@postgresql.org>
Sent: Saturday, April 06, 2002 9:59 PM
Subject: Re: [PATCHES] Completed pg_depend support


> > Also, try to drop type int4 ;)  Restricts by default (fresh
initdb).
> >
> > template1=# drop type int4;
> > ERROR:  Drop Restricted as Table pg_inherits Depends on Type int4
> >
> > TODO.depend is the list of actions I needed to do (or did).  More
or
> > gives a list of affected areas.
>
> Do superusers have more privileges than normal users?  ie. Does it
say
> prevent normal users from doing hideous stuff like dropping int4,
but allows
> a superuser to do it if they really want to?
>
> Chris
>
>


Re: Completed pg_depend support

From
Tom Lane
Date:
"Rod Taylor" <rbt@zort.ca> writes:
> The CASCADE behaviour will allow it to be dropped -- no matter what
> (to a point).

Somewhere along about the point where it tries to drop pg_class,
problems will ensue ... not sure if we need any specific defenses
against that, or if we can assume that the inevitable elog(ERROR)
will safely roll us back.

            regards, tom lane