Subject Re: Naturally updatable views
Author willhonor
--- In firebird-support@yahoogroups.com, Helen Borrie <helebor@...> wrote:
> Views that are not naturally updatable can be made updatable if you
have before insert triggers to take care of the non-nullable fields.
If you declare a default for a non-nullable field and don't include
that field in your insert or update set then it will kick in in time
to save you from a constraint error.

Ok, so as long as I have triggers on the View or table. Or I specify a
default on the field/domain then the view remains updatable?


>
> If you're using > Fb 1.5, make sure you read the release notes or
language updates as well. The rules for views have been subtly
changing from release to release.

Thanks, I will do so.

>
> >Am I correct on this
>
> Perhaps not very clear what "naturally updatable" means. The book
does describe the difference in quite some detail.

From reading the book I understand that views which include joins,
subqueries or special readonly queries (select X from rdb$database
etc) are not naturally updatable. Views that have a simple sql on a
single table or that select from another view that has a simple query
are updatable.

>
> >or am I likely to get bitten further down the line?
>
> People get bitten further down the line when they rely on guesswork.
;-) Always test both execution and results of anything that's
designed to change data.

I had tested it but it wasn't doing what I expected. So I posted
here to ask the question. Not relying on guesswork at all just wanted
to clarify the rules.

Thank you for your help Helen. Your book has proved very helpful,
although it is starting to wear out now. Do you have any plans to
update it when firebird 2.5 / 3 are out?

Regards,
Will.