Subject | Re: BUG:"cannot update read-only view" with triggers! |
---|---|
Author | lisovnew <lisovnew@yahoo.com> |
Post date | 2003-01-21T11:34:16Z |
>the Firebird bug-tracker is NOT for your application bugs, it is forWell, I should apologize again, now for posting my question around
>bugs that have been identified in the database engine.
where it shouldn't be; I really believed this was engine bug, not
application'.
> Now, your problem becomes much clearer. The error is being raisedbecause
> your *view* contains a cross-join on rdb$database. By includingwhen
> rdb$database in the *view specification*, you have made it so that,
> the engine goes to construct the output set, it looks at the view'sdelete
> and insert triggers and the dependency of rdb$database upon theview, and
> says "oh no, this view has the potential to add to or delete fromJoin to rdb$database is really quite widespread trick that I met very
> rdb$database. Not allowed."
often in various postings here and in "IB-Architect" too (discussion
considering means of making view read-only, e.g. msg ID 3635); you
can find it in FB Open Bug #523589 description and others, and,
judging from that postings, it worked fine (at least, it did not
throw "cannot update.." error).
> Take the cross-join to rdb$database out of the view specificationand,
> instead, include it in your query specification. That should dothe trick
> to force the view to be read-only without affecting anything else.criterion
>
> Also, I'm sure you need the means to parameterise the selection
> in this view. By forcing it to a constant in the viewspecification you
> make this view fairly useless.I made this view to hide from application the means of storing many-
to-many relationships and make it look like common separate "special"
table, so that application doesn't need to know specific values
of 'Link_type_id': that's why I didn't parametrize selection
criterion.
As for taking the cross-join to rdb$database out of the view
specification and including it in my query specification - I just
can't understand how it would work; how can _query_ specification
make _view_ read-only? This may be my ignorance again, but I just
can't comprehend it; read-only result set of a query (from
application point of view) doesn't mean read-only view, so when I'll
try to pass:
insert into V_OBJECT_DOCUMENT
(OBJECT_ID, DOCUMENT_ID)
values
(1111, 22222)
it will throw error about Link_type_id NULL value, 'cause it still
will be trying to perform default action along with the trigger (or,
if I'll include Link_type_id in view specification, it will post the
record twice).
I really feel confused taking such a lot of your time, but I'm
definitely not the first to encounter such problem, and I believe it
to be serious enough, so it needs to be cleared out at last.
lisov.