Issue Details (XML | Word | Printable)

Key: CORE-2920
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Vlad Khorsun
Reporter: Dmitry Yemanov
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Firebird Core

Incorrect execution of volatile SQL statements inside EXECUTE STATEMENT

Created: 12/Mar/10 01:03 PM   Updated: 12/Mar/10 03:39 PM
Component/s: Engine
Affects Version/s: 2.5 Beta 1, 2.5 Beta 2, 2.5 RC1, 2.5 RC2
Fix Version/s: 2.5 RC3, 3.0 Alpha 1

Time Tracking:
Not Specified

Planning Status: Unspecified


 Description  « Hide
Test case:

recreate table bugtest (id int)
insert into bugtest (id) values (123)

recreate procedure p_bugtest (in_id int)
  returns (cnt int)
as
  declare predicate varchar(1000);
begin
  if (:in_id is null) then
    predicate = ' ? is null';
  else
    predicate = ' id = ?';

  execute statement ('select count(*) from bugtest where' || predicate) (:in_id)
  into :cnt;
end

execute procedure p_bugtest (123)
-- cnt = 1
execute procedure p_bugtest (null)
-- cnt = 1
execute procedure p_bugtest (123)
-- cnt = 0 !!!


 All   Comments   Work Log   Change History   Version Control   FishEye      Sort Order: Ascending order - Click to sort in descending order
There are no comments yet on this issue.