Skip to content

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

Open
Noremos wants to merge 4 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 4 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 Outdated
Copy link
Copy Markdown
Member

@AlexPeshkoff AlexPeshkoff left a comment

Choose a reason for hiding this comment

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

Fix is OK & and I approve it but one question. Why does dsc_address change with same value? Sorry but looks strange for constant.

@Noremos
Copy link
Copy Markdown
Contributor Author

Noremos commented Jun 1, 2026

Fix is OK & and I approve it but one question. Why does dsc_address change with same value? Sorry but looks strange for constant.

This was a bug. First, the Package::reload method was called, creating a constant. Then, in the Package::checkReload method, m_callReload remained true, so the Package::reload method was called again. Constants were added and recreated. That's why I moved m_callReload = false to Package::reload in this PR.

@aafemt
Copy link
Copy Markdown
Contributor

aafemt commented Jun 1, 2026

m_callReload remained true

Cannot dsc_address to be used instead of the flag to indicate that the constant is loaded? (With value NULL indicated by dsc_flags.)

@AlexPeshkoff
Copy link
Copy Markdown
Member

AlexPeshkoff commented Jun 1, 2026 via email

@Noremos
Copy link
Copy Markdown
Contributor Author

Noremos commented Jun 1, 2026

m_callReload remained true

Cannot dsc_address to be used instead of the flag to indicate that the constant is loaded? (With value NULL indicated by dsc_flags.)

The m_callReload is located inside the package class. The dsc_address is a field of the ConstantValue class, so it is not a correct optimization

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