Skip site navigation (1) Skip section navigation (2)

Re: pg_depend patch

From: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
To: "Rod Taylor" <rbt(at)zort(dot)ca>, <pgsql-patches(at)postgresql(dot)org>
Subject: Re: pg_depend patch
Date: 2002-03-15 03:06:31
Message-ID: GNELIHDDFBOCMGBFGEFOKEMDCBAA.chriskl@familyhealth.com.au (view raw or flat)
Thread:
Lists: pgsql-patches
I was thinking.  With a patch such as this, this is the situation:

You have a view or a function or something that depends on another view.
You want to update the view that these depend on.  Up until this patch is
applied, you can just drop the view and recreate it and the things that
depend on it will carry on working.

However, after this patch you only have two choices: drop the view and have
everything that depends on it disappear, or have your drop attempt denied by
restrict.

ie. After this patch is applied, it will be essential that CREATE [OR
REPLACE] is implemented for all types of objects involved in the dependency
hierarchy.

Is this correct?

Chris

> -----Original Message-----
> From: pgsql-patches-owner(at)postgresql(dot)org
> [mailto:pgsql-patches-owner(at)postgresql(dot)org]On Behalf Of Rod Taylor
> Sent: Thursday, 14 March 2002 10:50 PM
> To: pgsql-patches(at)postgresql(dot)org
> Subject: [PATCHES] pg_depend patch
>
>
> While looking forward to the domain patch set being applied, I started
> pg_depend support.
>
> 2 main functions, dependCreate() and dependDelete().
>
> dependCreate() generates a dependence between two system objects, and
> can optionally be forced to 'always cascade' the drop for items such as
> complex types, toast tables or indexes.
>
> dependDelete() removes or restricts the removal of all dependent objects
> on the one being dropped informing the user of the cascade.
>
> Affected areas (thus far):
> - drop type
> - drop view
> - drop trigger
> - drop sequence
> - drop rule
> - drop operator
> - drop language
> - drop function
> - drop index
> - drop aggregate
> - create language
> - create index
> - create type
>
> Type to array type relation is now done using an 'always cascaded'
> dependent relationship.
>
>
> To be completed (currently uses old 'ignorance is bliss' methods):
> - Drop serial on column drop (tables cascade to drop all columns)
> - Drop triggers via always cascade relationship (uses hard coded method)
> - create [ view | trigger | table | sequence | rule | operator |
> function | aggregate ] need to record dependencies on creation time.
> - RESTRICT / CASCADE keywords should be used with drop statements
> (Always restricts, unless it's an implicit cascade)
> - BOOTSTRAPPED objects need their dependencies recorded.
>
>
> Problems:
> Regression tests can fail as the OID in names of some objects (toast
> tables, indexes, etc) are never the same.  Solution is to not mention
> implicit cascades, or potentially to mark specific implicit cascades as
> 'silent drop' while others are 'informed drop'.
>
>
> Thanks for taking a look.  I'm sure I did some weird stuff.
>
>
> BTW.  In dependDelete() each loop rescans incase while running down the
> tree something else depended on an object I wanted to drop.  A good case
> was an index, function, type loop.  Dropping them without rescanning and
> a CommandCounterIncrement() would cause double tuple update issues.
>


In response to

Responses

pgsql-patches by date

Next:From: Peter EisentrautDate: 2002-03-15 03:30:05
Subject: Re: pg_depend patch
Previous:From: Bruce MomjianDate: 2002-03-14 22:44:52
Subject: Re: ALTER TABLE OWNER: handle toast

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group