Обсуждение: how to modify a view

Поиск
Список
Период
Сортировка

how to modify a view

От
"J. Manuel Velasco - UBILIBET"
Дата:
Hello,

The DB I am using has views. I need to modify the view adding one field to the QUERY that build the query.

When I edit the VIEW and add the field, I get the error that tells me "It's not possible to change columns number in a view"

So, do I need to remove the complete VIEW and create a new one ? Or there is other way to modify the view. ?¿

Thanks in advance,
--
Вложения

Re: how to modify a view

От
Shane Ambler
Дата:
J. Manuel Velasco - UBILIBET wrote:
> Hello,
>
> The DB I am using has views. I need to modify the view adding one
> field to the QUERY that build the query.
>
> When I edit the VIEW and add the field, I get the error that tells me
> "It's not possible to change columns number in a view"
>
> So, do I need to remove the complete VIEW and create a new one ? Or
> there is other way to modify the view. ?¿
>
> Thanks in advance, --

Yes - The only way to do it is DROP VIEW... then CREATE VIEW... - the
catch is any other views that depend on the view you wish to drop.


<manual quote>
You can only replace a view with a new query that generates the
identical set of columns (i.e., same column names and data types).
</manual quote>




--

Shane Ambler
pgSQL (at) Sheeky (dot) Biz

Get Sheeky @ http://Sheeky.Biz

Re: how to modify a view

От
Reece Hart
Дата:
On Wed, 2008-05-21 at 02:43 +0930, Shane Ambler wrote:
Yes - The only way to do it is DROP VIEW... then CREATE VIEW... - the
catch is any other views that depend on the view you wish to drop.

Tip: It's sometimes useful to rename an existing view or table to deprecate it. (I use names like _someview_v_20080520.) When you rename a table or view, the definition of any views which depend on them will be updated appropriately. This is particularly handy when you have several layers of views and don't want to break current behavior.

-Reece

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

Re: how to modify a view

От
"J. Manuel Velasco - UBILIBET"
Дата:
Thank you Shane


All beings be happy,
·_- manou
Shane Ambler escribió:
J. Manuel Velasco - UBILIBET wrote:
Hello,

The DB I am using has views. I need to modify the view adding one
field to the QUERY that build the query.

When I edit the VIEW and add the field, I get the error that tells me
"It's not possible to change columns number in a view"

So, do I need to remove the complete VIEW and create a new one ? Or
there is other way to modify the view. ?¿

Thanks in advance, --

Yes - The only way to do it is DROP VIEW... then CREATE VIEW... - the
catch is any other views that depend on the view you wish to drop.


<manual quote>
You can only replace a view with a new query that generates the
identical set of columns (i.e., same column names and data types).
</manual quote>





--
Вложения