On Tue, 2007-09-04 at 07:42 +0000, Luiz K. Matsumura wrote:
> When we do a command Create or Replace View that change columns of
> previous view we got a error.
Right. Many folks consider views to be a sort of API to the database.
Using views to provide an API substantially insulates client code from
implementation changes because the logic "behind" a view can change
without changing the interface. So, although the prohibition against
changing the column specification is occasionally irksome, I have grown
to appreciate the protection from wanton changes to the API that this
Here are two tricks that may help you (and which you may already know):
1) Views can be renamed. When you do this, nearly all intra-cluster
references to it are updated. So, if your view is /solely/ for use
within the database, this allows you to deprecate a view.
2) Views can depend on views. So, consider your view1 as version1, then
create view2 which depends on view1 and merely recasts the type1 column
as character(3). New code can use view2 and old code can be migrated to
view2 as needed.
Reece Hart, http://harts.net/reece/, GPG:0x25EC91A0
In response to
pgsql-bugs by date
|Next:||From: Luiz K. Matsumura||Date: 2007-09-04 18:09:16|
|Subject: Re: BUG #3597: CREATE OR REPLACE VIEW|
|Previous:||From: Jukka Holappa||Date: 2007-09-04 17:02:30|
|Subject: Re: BUG #3595: Segmentation fault with a simple select query|