DROP TABLE is allowed while package HEADER contains reference on its column(s).
-------------------------------------------------------------------------------

                 Key: CORE-4974
                 URL: http://tracker.firebirdsql.org/browse/CORE-4974
             Project: Firebird Core
          Issue Type: Bug
          Components: Engine
            Reporter: Pavel Zotov


Test:
####

set list on;

recreate table tbl_test(id int generated by default as identity, x int default 
100);
commit;

set term ^; --------------------------------- [ 1:begin ]
create package pkg_test as
begin
    procedure sp_test(a type of column tbl_test.x);
end
^ ------------------------------------------- [ 1:end ]

create package body pkg_test as
begin
    procedure sp_test (a type of column tbl_test.x) as
        declare c int;
    begin
        select count(*) from tbl_test t where t.x = :a into c;
    end
end
^
set term ;^
commit;

select 'Before ALTER package statement, w/o any changes in it' as msg, 
p.rdb$package_name, p.rdb$valid_body_flag
from rdb$packages p;

set term ^; --------------------------------- [ 2:begin ]
alter package pkg_test as
begin
    procedure sp_test(a type of column tbl_test.x);
end
^ ------------------------------------------- [ 2:end ]
set term ;^
commit;

select 'After ALTER package statement, w/o any changes in it' as msg, 
p.rdb$package_name, p.rdb$valid_body_flag
from rdb$packages p;


set echo on;

drop table tbl_test; ----------------- PASSED. Though reference to its column 
'X' present in package HEADER.

set echo off;

show package pkg_test;


Output:
######

MSG                             Before ALTER package statement, w/o any changes 
in it
RDB$PACKAGE_NAME                PKG_TEST                                        
                                             
RDB$VALID_BODY_FLAG             1



MSG                             After ALTER package statement, w/o any changes 
in it
RDB$PACKAGE_NAME                PKG_TEST                                        
                                             
RDB$VALID_BODY_FLAG             0


drop table tbl_test;

set echo off;
PKG_TEST                        
Header source:
begin
    procedure sp_test(a type of column tbl_test.x); 
------------------------------------ [ !!! ] 
end

Body source (invalid):
begin
    procedure sp_test (a type of column tbl_test.x) as
        declare c int;
    begin
        select count(*) from tbl_test t where t.x = :a into c;
    end
end

PS. 

BTW, why the body of package became invalid if I did not intruduce any changes 
in its header (compare text between  [1:begin]..[1:end]  and 
[2:begin]..[2:end]) ?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to