Closed
Description
Consider following script (note that rows can be insert into the table 'TMAIN' using two cases: directly and using 'insert ... select'; first case is commented out and second is used here):
set bail on;
shell if exist r:\temp\tmp4test.fdb del r:\temp\tmp4test.fdb;
create database 'localhost:r:\temp\tmp4test.fdb' user 'sysdba' password 'masterkey';
set echo on;
set bail OFF;
set list on;
recreate table tmain(id1 int, id2 int, id3 int, unique(id1, id2, id3));
/*
-- #######################
-- INSERT VALUES DIRECTLY
-- #######################
insert into tmain(id1, id2, id3) values(null, null, null);
insert into tmain(id1, id2, id3) values(null, null, 1000);
insert into tmain(id1, id2, id3) values(null, 1000, null);
insert into tmain(id1, id2, id3) values(null, 1000, 1000);
insert into tmain(id1, id2, id3) values(1000, null, null);
insert into tmain(id1, id2, id3) values(1000, null, 1000);
insert into tmain(id1, id2, id3) values(1000, 1000, null);
insert into tmain(id1, id2, id3) values(1000, 1000, 1000);
-- */
-- /*
-- #######################
-- INSERT USING SELECT ...
-- #######################
insert into tmain(id1, id2, id3)
with
a as (
select 1000 as v from rdb$database union all
select 1000 as v from rdb$database union all
select null as v from rdb$database
)
select distinct a1.v, a2.v, a3.v
from a a1
cross join a a2
cross join a a3
;
-- */
select 1 from mon$database;
--select 1 from rdb$database;
quit;
In 6.0.0.849 this script finishes w/o problem (CONSTANT 1
is issued)
In 6.0.0.853 tail of output will be:
select 1 from mon$database;
Statement failed, SQLSTATE = HY001
Stack overflow. The resource requirements of the runtime stack have exceeded the memory available to it.
No such problem if we uncomment block marked as INSERT VALUES DIRECTLY
and comment out INSERT USING SELECT ...
.
Also, no any problem if we query RDB$DATABASE instead of any MON$ table.