Re: Don't cascade drop to view

From: Erik Jones <erik(at)myemma(dot)com>
To: Sim Zacks <sim(at)compulab(dot)co(dot)il>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Don't cascade drop to view
Date: 2008-01-17 17:10:25
Message-ID: 6DD1F7A9-34A0-4044-B941-5970F972F97B@myemma.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)myemma(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2008-01-17 17:45:00 Re: Don't cascade drop to view
Previous Message Steve Clark 2008-01-17 17:07:26 Re: losing db user password going from 7.4 to 8.2