Обсуждение: how to modify a view
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,
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,
--
![](/media/maillist_attaches/pgsql-general/2008/05/20/4832FBAB.9030301@ubilibet.com/Manucastellano.jpg)
![](/media/maillist_attaches/pgsql-general/2008/05/20/4832FBAB.9030301@ubilibet.com/Manucastellano.jpg)
Вложения
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
On Wed, 2008-05-21 at 02:43 +0930, Shane Ambler wrote:
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
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 |
Thank you Shane
All beings be happy,
·_- manou
Shane Ambler escribió:
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>
--
![](/media/maillist_attaches/pgsql-general/2008/05/21/4833D40A.5010804@ubilibet.com/Manucastellano.jpg)
![](/media/maillist_attaches/pgsql-general/2008/05/21/4833D40A.5010804@ubilibet.com/Manucastellano.jpg)