Subject | Re: BUG:"cannot update read-only view" with triggers! |
---|---|
Author | lisovnew <lisovnew@yahoo.com> |
Post date | 2003-01-21T13:11:25Z |
I need to make a few additions regarding this error:
a)my initial guess that this error could be avoided by queriyng
independent views was wrong - it isn't influenced by other views in
any regular manner, so there's no systematic behavior
b)after some unsuccessful attempts to open view and gigving "cannot
update.." message, it can throw "unsuccessful metadata update.
request depth exceeded. " error
c)the most important:) I've got another view, based on the same table
T_OBJECT_LINKS, which uses the same trick with rdb$database, and it
works fine all the time!:
CREATE VIEW V_MOVEMENT_CAUSE_ROUTE(
MOVEMENT_CAUSE_ID,
ROUTE_ID)
AS
select Object_ID_Left, Object_ID_Right
from T_Object_Links, rdb$database
where T_object_links.Link_type_id = -5003
;
SET TERM ^ ;
CREATE TRIGGER TBD_V_MOVEMENT_CAUSE_ROUTE
as
begin
/* delete from t object links */
delete from T_Object_Links
where T_object_links.Link_type_id = -5003
and T_object_links.Object_id_left = old.Movement_cause_id
and T_object_links.Object_id_right = old.Route_id;
end^
CREATE TRIGGER TBI_V_MOVEMENT_CAUSE_ROUTE
as
begin
/* insert into t object links */
insert into T_Object_Links
(Link_Type_ID, Object_ID_left, Object_ID_Right)
values
(-5003, new.Movement_cause_id, new.Route_id);
end^
d)I tried to use SELECT DISTINCT in view definition instead of join
with rdb$database, but no effect - same error.
I just seem to be completely confused about the matter, I can't
figure out any logic in it, hence - can't even guess the cause of it.
a)my initial guess that this error could be avoided by queriyng
independent views was wrong - it isn't influenced by other views in
any regular manner, so there's no systematic behavior
b)after some unsuccessful attempts to open view and gigving "cannot
update.." message, it can throw "unsuccessful metadata update.
request depth exceeded. " error
c)the most important:) I've got another view, based on the same table
T_OBJECT_LINKS, which uses the same trick with rdb$database, and it
works fine all the time!:
CREATE VIEW V_MOVEMENT_CAUSE_ROUTE(
MOVEMENT_CAUSE_ID,
ROUTE_ID)
AS
select Object_ID_Left, Object_ID_Right
from T_Object_Links, rdb$database
where T_object_links.Link_type_id = -5003
;
SET TERM ^ ;
CREATE TRIGGER TBD_V_MOVEMENT_CAUSE_ROUTE
as
begin
/* delete from t object links */
delete from T_Object_Links
where T_object_links.Link_type_id = -5003
and T_object_links.Object_id_left = old.Movement_cause_id
and T_object_links.Object_id_right = old.Route_id;
end^
CREATE TRIGGER TBI_V_MOVEMENT_CAUSE_ROUTE
as
begin
/* insert into t object links */
insert into T_Object_Links
(Link_Type_ID, Object_ID_left, Object_ID_Right)
values
(-5003, new.Movement_cause_id, new.Route_id);
end^
d)I tried to use SELECT DISTINCT in view definition instead of join
with rdb$database, but no effect - same error.
I just seem to be completely confused about the matter, I can't
figure out any logic in it, hence - can't even guess the cause of it.