Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong current timestamp evaluation for selectable procedures [CORE1419] #1837

Closed
firebird-issue-importer opened this issue Aug 20, 2007 · 8 comments

Comments

@firebird-issue-importer

Submitted by: @dyemanov

Is related to QA161

In our implementation, CURRENT_DATE/TIME[STAMP] values are evaluated at the request (aka SQL statement) start time and are permanent for the duration of that request. This rule includes the nested calls (procedures and triggers) as well, i.e. they inherit the parent's timestamp, thus providing the stable date-time value for the entire call stack. However, this rule is broken for selectable procedures that evaluate current date-time values at every invocation.

Test case:

set term ^;

create procedure ts1 returns ( ts timestamp )
as
begin
ts = current_timestamp;
suspend;
end^

create procedure ts2 returns ( ts_self timestamp, ts_execute timestamp, ts_select timestamp )
as
declare cnt int = 1000000;
begin
ts_self = current_timestamp;
execute procedure ts1 returning_values :ts_execute;
select ts from ts1 into :ts_select;
suspend;

while (cnt > 0) do
cnt = cnt - 1;

ts_self = current_timestamp;
execute procedure ts1 returning_values :ts_execute;
select ts from ts1 into :ts_select;
suspend;
end^

set term ;^

commit;

select cast(ts_self as varchar(50)), cast(ts_execute as varchar(50)), cast(ts_select as varchar(50)) from ts2;
-- values in all the rows and columns should be the same

Commits: 8d6f5c8 8aaef3c

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Aug 27, 2007

Modified by: @dyemanov

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 2.1 Beta 2 [ 10190 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Nov 1, 2007

Modified by: @dyemanov

Fix Version: 2.0.4 [ 10211 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Dec 29, 2007

Modified by: @pcisar

Link: This issue is related to QA161 [ QA161 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jan 28, 2008

Modified by: @pcisar

Workflow: jira [ 12852 ] => Firebird [ 15351 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Apr 3, 2008

Commented by: @pmakowski

Q/A test ok and qmtest made

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Apr 3, 2008

Modified by: @pmakowski

status: Resolved [ 5 ] => Closed [ 6 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jan 19, 2016

Modified by: @pavel-zotov

QA Status: No test

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jan 19, 2016

Modified by: @pavel-zotov

QA Status: No test => Done successfully

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