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

From Martijn van Oosterhout
Subject Re: Don't cascade drop to view
Date
Msg-id 20080117174500.GA21761@svana.org
Whole thread Raw
In response to Re: Don't cascade drop to view  (Erik Jones <erik@myemma.com>)
List pgsql-general
On Thu, Jan 17, 2008 at 11:10:25AM -0600, Erik Jones wrote:
> 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.

I'd expect it to throw an error that the tables are missing. I ran into
this today. All it really requires is that the view definition be
parsed at use time rather than at creation time.

> 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.

As you say, functions are compiled at use time, and hence don't suffer
this problem. You can build a view on the function and it should be
transparent...

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Those who make peaceful revolution impossible will make violent revolution inevitable.
>  -- John F Kennedy

Attachment

pgsql-general by date:

Previous
From: Erik Jones
Date:
Subject: Re: Don't cascade drop to view
Next
From: Steve Clark
Date:
Subject: pg_dumpall