Subject | complex dependencies make view unupdatable |
---|---|
Author | lisovnew <lisovnew@yahoo.com> |
Post date | 2003-02-19T11:16:46Z |
I've encountered a serious problem while developing my IB database:
complex dependencies envolving updatable views may make one of them
refuse to work; I've got a following model (needed part shown only; |
means "inserts into", implemented by trigger):
Updatable_View_1
|
Table_1
|
Updatable_View_2
|
Table_2
Actually, there a lot of tables like Table_1 with updatable views on
them, and these tables insert some data into Table_2 through
Updatable_View_2; so, it's enough only one of them to reference
Updatable_View_2 in it's triggers for Updatable_View_2 to become
unupdatable: whenever you try to open it throws an error "cannot
update read-only view ..."; moreover, any further change in metadata
is impossible 'cause it throws the same error!
It doesn't matter how Updatable_View_2 is made read-only (in order
that IB wouldn't perform default actions on it since we've got our
own triggers to do all job) - join with other table, join with
rdb$database, DISTINCT. Also, this situation doesn't apply to stored
procedures - they can reference updatable views without problems.
The problem is in triggers trying to insert into views.
I've worked around this problem, having changed "insert into
Updatable_View_2.." with stored procedure call, which inserts into
Table_2.
Unfortunately(?:), I didn't manage to recreate this case on "clear"
database, that's why I didn't post it to Bugtracker; but the problem
exists, I just don't know the cause of it (engine or some bug inside
my DB, though inspecting rdb$dependencies didn't clear out the case);
have anybody ever encountered the same situation?
Thanks in advance for your answers.
complex dependencies envolving updatable views may make one of them
refuse to work; I've got a following model (needed part shown only; |
means "inserts into", implemented by trigger):
Updatable_View_1
|
Table_1
|
Updatable_View_2
|
Table_2
Actually, there a lot of tables like Table_1 with updatable views on
them, and these tables insert some data into Table_2 through
Updatable_View_2; so, it's enough only one of them to reference
Updatable_View_2 in it's triggers for Updatable_View_2 to become
unupdatable: whenever you try to open it throws an error "cannot
update read-only view ..."; moreover, any further change in metadata
is impossible 'cause it throws the same error!
It doesn't matter how Updatable_View_2 is made read-only (in order
that IB wouldn't perform default actions on it since we've got our
own triggers to do all job) - join with other table, join with
rdb$database, DISTINCT. Also, this situation doesn't apply to stored
procedures - they can reference updatable views without problems.
The problem is in triggers trying to insert into views.
I've worked around this problem, having changed "insert into
Updatable_View_2.." with stored procedure call, which inserts into
Table_2.
Unfortunately(?:), I didn't manage to recreate this case on "clear"
database, that's why I didn't post it to Bugtracker; but the problem
exists, I just don't know the cause of it (engine or some bug inside
my DB, though inspecting rdb$dependencies didn't clear out the case);
have anybody ever encountered the same situation?
Thanks in advance for your answers.