Skip to content

Fix calling reload twice for package constants and improve hash calculation#9045

Open
Noremos wants to merge 3 commits into
FirebirdSQL:masterfrom
Noremos:package_constant_hash_reload_fix
Open

Fix calling reload twice for package constants and improve hash calculation#9045
Noremos wants to merge 3 commits into
FirebirdSQL:masterfrom
Noremos:package_constant_hash_reload_fix

Conversation

@Noremos
Copy link
Copy Markdown
Contributor

@Noremos Noremos commented Jun 1, 2026

Fixes for the issue described in https://groups.google.com/g/firebird-devel/c/xIxhL_QAjEg : wierd error message when using a consatnt.

To reproduce:

set term ^;
CREATE PACKAGE TEST
AS
BEGIN
    CONSTANT C1 INTEGER = 10;
END^

CREATE PROCEDURE P1(I INT) RETURNS (PROCEDURE_OUTPUT INT)
AS
BEGIN
    PROCEDURE_OUTPUT = TEST.C1;
    SUSPEND;
END^

set term ;^
commit;

select TEST.C1 from rdb$database ;
select * from P1(0);
commit;

Comment thread src/jrd/Package.epp


// Exclude address from the hash calculation due to it possible change
constexpr inline ULONG DSC_SIZE_TO_HASH = sizeof(dsc) - offsetof(dsc, dsc_address);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Size of dsc is 12, offset of dsc_address is 8. 12 - 8 = 4. Are you sure that this is a right value?
Perhaps either offset(dsc_offset) or offset(dsc_flags) + sizeof(dsc_flags) should be here.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DSC_SIZE_TO_HASH = offsetof(dsc, dsc_address);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants