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

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

-- 
Reece Hart, http://harts.net/reece/, GPG:0x25EC91A0

Reply via email to