Re: What is the point of create or replace view command

From: Roman Neuhauser <neuhauser(at)sigpipe(dot)cz>
To: Chris Velevitch <chris(dot)velevitch(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: What is the point of create or replace view command
Date: 2006-06-05 17:14:58
Message-ID: 20060605171458.GA11358@dagan.sigpipe.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

# chris(dot)velevitch(at)gmail(dot)com / 2006-06-05 16:19:19 +1000:
> On 6/5/06, Joe Conway wrote:
> >Chris Velevitch wrote:
> >> But what about my original question?
> >>
> >> "What is the point of the create or replace view command if you
> >> can't change the
> >> column and data types?"
> >
> >-- create table t1
> >create table t1(f int);
> >-- create view v1 based on table t1
> >create view v1 as select * from t1;
> >-- create view v2 based on view v1
> >create view v2 as select * from v1;
> >-- attempt to drop and recreate view v1 with a WHERE clause
> >drop view v1;
> >-- attempt to create or replace view v1 with a WHERE clause
> >create or replace view v1 as select * from t1 where 1 = 1;
> >-- attempt to create or replace view v1 with a different WHERE clause
> >create or replace view v1 as select * from t1 where 1 = 2;
>
> Sorry, I don't understand what you are trying to say as these examples
> don't change the number of columns, type of column or column names. So
> according to the description of the command, these will work.

The point of the create or replace view command is that you may
need to change other attributes of the view (see Joe's examples),
and then the [OR REPLACE] clause is useful.

Now, I don't disagree that being able to CREATE OR REPLACE even
when the "interface" changes wouldn't be useful. You're welcome
to provide a patch that does this at least when there are no objects
that depend on the view in question.

--
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man. You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tony Caduto 2006-06-05 18:21:48 Is it a big deal to change the user the DB runs under?
Previous Message Greg Stark 2006-06-05 16:53:57 Re: COLLATE