Private packaged temporary table can not be accessed via ES from packaged unit

15 views
Skip to first unread message

Pavel Zotov

unread,
May 31, 2026, 6:23:18 PM (3 days ago) May 31
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 sequence g;
create or alter package pg_temp as
begin
    temporary table t_pub(
        id int
    ) on commit preserve rows
    ;
    procedure sp_pub_dml(a_id int)
    ;
    procedure sp_priv_dml_1(a_id int)
    ;
    procedure sp_priv_dml_2(a_id int)
    ;
end
;
recreate package body pg_temp as
begin
    temporary table t_priv(
        id int
    ) on commit preserve rows
    ;

    procedure sp_pub_dml(a_id int) as
    begin
        execute statement ('insert into pg_temp.t_pub(id) values(?)') (a_id);
    end

    procedure sp_priv_dml_1(a_id int) as
    begin
        insert into pg_temp.t_priv(id) values(:a_id);
    end

    procedure sp_priv_dml_2(a_id int) as
    begin
        execute statement ('insert into pg_temp.t_priv(id) values(?)') (a_id);
    end
end
;
commit;
--connect 'localhost:r:\temp\tmp4test.fdb' user sysdba password 'masterkey';

set bail off;

execute procedure pg_temp.sp_pub_dml( 1 );

execute procedure pg_temp.sp_priv_dml_1( 123 );

execute procedure pg_temp.sp_priv_dml_2( 456 );

==========

Its outcome will be:
. . .
set bail off;

execute procedure pg_temp.sp_pub_dml( 1 );

execute procedure pg_temp.sp_priv_dml_1( 123 );

execute procedure pg_temp.sp_priv_dml_2( 456 );
Statement failed, SQLSTATE = 42000
Table "T_PRIV" is private to package "PUBLIC"."PG_TEMP"
-At procedure "PUBLIC"."PG_TEMP"."SP_PRIV_DML_2" line: 20, col: 9

Packaged unit '' sp_pub_dml'  has no problems with running DML against public table via ES.
But packaged unit ' sp_priv_dml_2' fails when doing the same against private table via ES.
Is it expected ?

Adriano dos Santos Fernandes

unread,
May 31, 2026, 7:37:47 PM (3 days ago) May 31
to firebir...@googlegroups.com
On 5/31/26 19:23, Pavel Zotov wrote:
> Is it expected ?

Yes.


Adriano

Reply all
Reply to author
Forward
0 new messages