Consider script:
============
set bail on;
set list on;
set keep_tran on;
set echo 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 autoddl off;
commit;
recreate
GLOBAL TEMPORARY
table test(f01 int)
--on commit DELETE rows
on commit PRESERVE rows
;
insert into test(f01) select i from generate_series(1, 1000) as s(i);
--create index test_idx on test(f01);
create index test_idx on test computed by (f01);
--create index test_idx on test(f01) where f01 is not null;
drop index test_idx;
select
rr.rdb$relation_type as rel_type
,trim(ri.rdb$index_name) as idx_name
,ri.rdb$index_inactive as idx_inactive
,sign(octet_length(coalesce(ri.rdb$expression_source,''))) is_computed
,sign(octet_length(coalesce(ri.rdb$condition_source,''))) is_partial
from rdb$relations rr
left join rdb$indices ri using(rdb$relation_name)
where rr.rdb$relation_name = 'TEST'
;
commit; ----------------------- [ 1 ]
set count on;
select * from rdb$dependencies where rdb$depended_on_name = upper('test');
-- commit; ----------------------- [ 2 ]
drop table test;
commit;============
Its tail will be:
============
set count on;
select * from rdb$dependencies where rdb$depended_on_name = upper('test');
RDB$DEPENDENT_NAME TEST_IDX
RDB$DEPENDED_ON_NAME TEST
RDB$FIELD_NAME F01
RDB$DEPENDENT_TYPE 6
RDB$DEPENDED_ON_TYPE 0
RDB$PACKAGE_NAME <null>
RDB$DEPENDENT_SCHEMA_NAME PUBLIC
RDB$DEPENDED_ON_SCHEMA_NAME PUBLIC
Records affected: 1
-- commit; ----------------------- [ 2 ]
drop table test;
commit;
Statement failed, SQLSTATE = 42000
unsuccessful metadata update
-cannot delete
-TABLE "PUBLIC"."TEST"
-there are 1 dependencies============
So, after 'DROP TABLE' + 'COMMIT' we still can see some records in rdb$dependencies.
This can be observed only when index is COMPUTED BY (a in this example) or PARTIAL.
Same for GTT with 'on commit PRESERVE rows'.
No such problem when a table is permanent (not GTT).
No such problem when an index is regular.
PS.
If we UNcomment 'commit' statement marked as "[ 2 ]" then FB will
crash.
Checked on 6.0.0.1996-263e09d, 6.0.0.1995-e588f9e.
Dump, stack trace and snapshot 6.0.0.1996-263e09d are
here.