Packaged temporary tables. Only `INSERT` is allowed for them in the package body units

19 views
Skip to first unread message

Pavel Zotov

unread,
May 30, 2026, 6:17:43 PM (4 days ago) May 30
to firebird-devel
Consider script:
==========
set bail on;
set autoterm 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';

create or alter package pg_test as
begin
    temporary table pkt_open(id int) on commit preserve rows index pkt_open_id(id);
end
;

recreate package body pg_test as
begin
    temporary table pkt_priv(id int) on commit preserve rows index pkt_priv_id(id);
    procedure sp_modify_data as
    begin
        insert into pkt_open(id) values(1);
        insert into pkt_priv(id) values(1);
        --update pkt_open set id = -id rows 1;
        --update pkt_priv set id = -id rows 1;
        --delete from pkt_open;
        --delete from pkt_priv;
    end
end
;

==========

It will complete normally (no errors).
Now UNcomment any of 'UPDATE PKT_*' or 'DELETE FROM PKT_*' statements and repeat.
Outcome will be:
==========
Statement failed, SQLSTATE = 42S02
unsuccessful metadata update
-RECREATE PACKAGE BODY "PUBLIC"."PG_TEST" failed
-Dynamic SQL Error
-SQL error code = -204
-Table unknown
-"PUBLIC"."PKT_OPEN" // or "PKT_PRIV"
==========

Adriano dos Santos Fernandes

unread,
May 30, 2026, 6:56:07 PM (4 days ago) May 30
to firebir...@googlegroups.com
Fixed.


Adriano

Pavel Zotov

unread,
May 31, 2026, 6:35:47 AM (3 days ago) May 31
to firebird-devel
No more problem with DML, thanks. Separate test has been committed.


воскресенье, 31 мая 2026 г. в 01:56:07 UTC+3, Adriano dos Santos Fernandes:
Reply all
Reply to author
Forward
0 new messages