Re: pg_views.definition - Mailing list pgsql-hackers

From Christopher Kings-Lynne
Subject Re: pg_views.definition
Date
Msg-id GNELIHDDFBOCMGBFGEFOMECOCDAA.chriskl@familyhealth.com.au
Whole thread Raw
In response to Re: pg_views.definition  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: pg_views.definition  (Gavin Sherry <swm@linuxworld.com.au>)
List pgsql-hackers
> > We do, but as soon as you break the view by dropping an underlying
> > object it fails to reconstruct. So having the original view definition
> > at hand could be useful for some ALTER VIEW RECOMPILE command.
> 
> Note that the assumptions underlying this discussion have changed in
> CVS tip: you can't break a view by dropping underlying objects.
> 
> regression=# create table foo(f1 int, f2 text);
> CREATE TABLE
> regression=# create view bar as select * from foo;
> CREATE VIEW
> regression=# drop table foo;
> NOTICE:  rule _RETURN on view bar depends on table foo
> NOTICE:  view bar depends on rule _RETURN on view bar
> ERROR:  Cannot drop table foo because other objects depend on it
>         Use DROP ... CASCADE to drop the dependent objects too

Hrm - looks like we really need CREATE OR REPLACE VIEW...

Chris



pgsql-hackers by date:

Previous
From: Hiroshi Inoue
Date:
Subject: Re: DROP COLUMN
Next
From: "Christopher Kings-Lynne"
Date:
Subject: Re: Do we still need these NOTICEs?