Re: Don't cascade drop to view - Mailing list pgsql-general

From Erik Jones
Subject Re: Don't cascade drop to view
Date
Msg-id 6DD1F7A9-34A0-4044-B941-5970F972F97B@myemma.com
Whole thread Raw
In response to Re: Don't cascade drop to view  (Sim Zacks <sim@compulab.co.il>)
Responses Re: Don't cascade drop to view
List pgsql-general
On Jan 17, 2008, at 8:27 AM, Sim Zacks wrote:
> Peter Bauer wrote:
>> Hi all,
>> i made some views for the slony1 configuration tables in the
>> public schema which refer to tables in the _slony1 schema. My
>> problem now is that if the _slony1 schema is dropped with cascade
>> or slony is uninstalled, these views are also dropped and i have
>> to recreate them if slony is initialized again.
>> Is there a possibility to let the views live there even if the
>> refered schema or tables are dropped? Would a plpgsql Function
>> also be dropped?
>> thx,
>> Peter
>
>> Unfortuantely, there is no way around it.
>> Without cascade it won't let you delete the schema or table.
>> Functions will not be dropped.

If you dropped tables out from under views, how would you expect them
to act if someone were to query them?  Inconsistent and unpredictable
are just two words I'd use to describe a system that allowed that.
However, if these are relatively simple views, you may be able to get
away with re-implementing them as functions that return sets of
whatever record type your views are.

If you're building custom views that depend on a separate package
then you're going to be pretty much required to write scripts to
generate those view and custom install scripts for the package you're
building on.  Oh, and document all of that, as well.  If you don't do
this you'll be stuck managing things by hand which, on all but teeny
tiny projects, is a BadThing.

Erik Jones

DBA | Emma®
erik@myemma.com
800.595.4401 or 615.292.5888
615.292.0777 (fax)

Emma helps organizations everywhere communicate & market in style.
Visit us online at http://www.myemma.com




pgsql-general by date:

Previous
From: Steve Clark
Date:
Subject: Re: losing db user password going from 7.4 to 8.2
Next
From: Martijn van Oosterhout
Date:
Subject: Re: Don't cascade drop to view