DECLARED TEMP TABLE. Bugcheck "record disappeared (186), file: Savepoint.cpp line: 281" when running core with incomatible data types

19 views
Skip to first unread message

Pavel Zotov

unread,
Jul 27, 2026, 5:49:32 PM (6 days ago) Jul 27
to firebird-devel
Following script has three EXECUTE BLOCKs:
=============
SET BAIL OFF;
shell if exist r:\temp\tmp4test.fdb del r:\temp\tmp4test.fdb;
create database 'localhost:r:\temp\tmp4test.fdb' user 'sysdba' password 'masterkey';
commit;

set list on;
set autoterm on;
create domain dm_rdb_key char(8) character set octets;
create table test(fn boolean);
commit;
set echo on;
-- /*
--------------------------- [ 1 ] -------------------------
execute block returns(
    local_proc_result_1 boolean
) as
begin
    -- output:
    -- SQLSTATE = 22018 / conversion error from string "DBKEY"
    -- (expected)
    insert into test values (false) returning rdb$db_key into local_proc_result_1;
    suspend;
end;
-- */

-- /*
--------------------------- [ 2 ] -------------------------
execute block returns(
    local_proc_result_2 boolean
) as
    declare local temporary table dtt_outer (
        fn boolean
    );
    declare procedure local_sp returns(local_proc_result_2 dm_rdb_key) as
    begin
        insert into dtt_outer values (false) returning not fn into local_proc_result_2;
        suspend;
    end
begin
    -- output:
    -- SQLSTATE = 22018 / conversion error from string "TRUE#x00#x00#x00#x00"
    -- (expected)
    execute procedure local_sp returning_values local_proc_result_2;
    suspend;
end;
--*/

--/*
--------------------------- [ 3 ] -------------------------
execute block returns (
    local_proc_result boolean
) as
    declare procedure local_sp returns(local_proc_result dm_rdb_key) as
        declare local temporary table dtt_inner (
            fn boolean
        );
    begin
        insert into dtt_inner values (false) returning not fn into local_proc_result;
        suspend;
    end
begin
    -- bugcheck with following in firebird.log:
    -- conversion error from string "TRUE#x00#x00#x00#x00"
-- At block line: 48, col: 5
-- internal Firebird consistency check (record disappeared (186), file: Savepoint.cpp line: 281)
    execute procedure local_sp returning_values local_proc_result;
    suspend;
end;
-- */

=============

All of them can compile but will fail at runtime because of types incomatibility.
But only 1st and 2nd will issue expected output ("conversion error").
EB marked as "[ 3 ]" causes bugcheck and firebird.log will contain:
==========
conversion error from string "TRUE#x00#x00#x00#x00"
At block line: 21, col: 5
internal Firebird consistency check (record disappeared (186), file: Savepoint.cpp line: 281)
...
Error writing data to the connection.
==========

This is URL to dump, stack-trace, firebird.log and FB snapshot (checked on 6.0.0.2092-0-3fa7269).


Adriano dos Santos Fernandes

unread,
Jul 28, 2026, 8:35:08 PM (5 days ago) Jul 28
to firebir...@googlegroups.com
On 7/27/26 18:49, Pavel Zotov wrote:
> Following script has three EXECUTE BLOCKs:

Fixed.


Adriano

Pavel Zotov

unread,
Jul 29, 2026, 6:39:14 AM (5 days ago) Jul 29
to firebird-devel

Fixed.

Confirmed fix, test has been committed. 
Reply all
Reply to author
Forward
0 new messages