Hi Folks,

I've done some investigation and learned that, given this test case:

   create table test(a int, b int, c int)
   insert into test(a, b, c) values (1, 2, 3)
   create view v1 as select a as b, b as a from test

   create view v2 as select * from v1

   drop view v1

Postgres and HSQLDB will immediately generate an error when attempting to
drop "v1", unless a "CASCADE" clause is included.

mysql, Oracle (and I think DB2) will not generate an error when dropping
"v1", but attempts to access "v2" will fail until "v1" is recreated. They do
not offer "CASCADE" clauses that operate in the same way as Postgres and
HSQLDB.

I'm currently implementing the Postgres/HSQLDB behaviour, although Thomas
hasn't approved or denied this yet (I'm guessing he's asleep right now!). I
would've had it finished, except that Dario has just added this "CREATE OR
REPLACE VIEW" requirement -- damn him!

Shouldn't have too long to wait for a patch from me, but Thomas may throw it
all away if it doesn't fit in with his plans (and that's totally fine btw --
he's the boss!)

Cheers
Kerry


On Thu, Jun 10, 2010 at 11:14 AM, Dario V. Fassi
<[email protected]>wrote:

> hi,
> >> Modify a view It's not a use case, it's a routine maintenance task.
> >>
> > I will add a feature request for "Drop with invalidate views (so that
> > source code is not lost).
> ok, thanks.
> > Check what other databases do exactly.
> >
> The sentence CREATE OR REPLACE VIEW  ala PgSql, it's my preferred way ,
> with a big DDL generation convenience.
>
> http://www.postgresql.org/docs/8.1/static/sql-createview.html
> http://www.postgresql.org/docs/8.1/static/sql-dropview.html
> http://www.postgresql.org/docs/8.1/static/sql-createview.html
>
> > However I suggest you have a copy of the view source code stored
> > somewhere outside the database
> Yes I going to define a table in the database to store the view source  ;-)
>
> regards,
> Dario
>
>
>
>
> --
> 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]<h2-database%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/h2-database?hl=en.
>
>

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

Reply via email to