-
-
Notifications
You must be signed in to change notification settings - Fork 262
Open
Description
Consider following script:
recreate table tbase(
id smallint primary key using index tbase_pk
);
insert into tbase(id) values(1);
commit;
create view v_base_a as select * from tbase;
create view v_base_b as select * from v_base_a;
alter view v_base_a as select * from v_base_b;
commit;
--show view v_base_a; ------ [ 1 ]
select * from v_base_a;
Is will raise "SQLSTATE = 54001 / Too many Contexts ... Maximum allowed is 256" (this is expected).
Now UNcomment line marked as [ 1 ] and repeat.
All FB (3.x ... 6.x) will infinitely hang with loading one of CPU cores up to 100%.
PS.
By contrast with this, similar trick with TABLES will not pass.
Definition of cyclic dependency directly between tables is impossible (fails immediately with 42000). Intermediate VIEW is needed for that.
But no problem occurs with infinite loop:
recreate table test_1(
id int
);
recreate table test_2(
id int
,x2 computed by( 1 )
);
alter table test_1 add x1 computed by ( (select min(x2) from test_2) );
recreate view v_test_1 as select id, x1 from test_1;
alter table test_2 alter x2 computed by ( (select min(x1) from v_test_1) ); -- passes!
commit;
insert into test_1(id) values(1);
commit;
set bail OFF;
show table test_1;
show table test_2;
show view v_test_1;
select * from test_1;
-- issues:
set bail OFF;
show table test_1;
ID INTEGER Nullable
X1 Computed by: ( (select min(x2) from test_2) )
show table test_2;
ID INTEGER Nullable
X2 Computed by: ( (select min(x1) from v_test_1) )
show view v_test_1;
ID INTEGER Nullable
X1 INTEGER Expression
View Source:
==== ======
select id, x1 from test_1
select * from test_1; -- fails with "SQLSTATE = 42000 / Cannot have circular dependencies with computed fields"
Statement failed, SQLSTATE = 42000
Cannot have circular dependencies with computed fields
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels