Sergei, this behavior it's not documented and very confusing since almost all dbms conserve the original view's sql text and then * is always * (all columns).
There are other issue related to CREATE VIEW, it's that H2 store an optimized form of create view sql, and in complex view the stored sql text can be very different from the original. I think this might be criticized as some form of data loss. PostgreSQL, for example, also makes some cosmetic changes on the sql creation of a view, in change DB2 preserves the original text of view creation but internally runs an optimized version of it. regards, Dario El 05/10/10 03:33, Sergi Vladykin escribió: > Hi, > This is a correct behavior. The view actually doesn't contain > wildcards, it contains all table columns for the moment of creation. > So if you want to add the column to the view too you have to > explicitly recreate it. > > On 5 окт, 10:04, "[email protected]" <[email protected]> wrote: >> Hi, >> >> I wonder if followings is a correct behavior or a bug. >> >> sql> CREATE TABLE t (a INT,c INT); >> sql> CREATE VIEW tv AS SELECT * FROM t; >> sql> SELECT * FROM tv; >> A |C >> >> sql> ALTER TABLE t ADD COLUMN b INT BEFORE c; >> sql> SELECT * FROM t; >> A |B |C >> sql> SELECT * FROM tv; >> A |C >> >> "ALTER TABLE" query to the table that has views is successful, >> but the view's column (as determined by asterisk) are not changed. >> I've used version 1.2.141. >> >> Thank you. -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.
