Issue Details (XML | Word | Printable)

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

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

In PSQL modules with declared cursors engine could assign value to the wrong variable

Created: 22/Sep/13 10:41 AM   Updated: 25/Sep/15 01:09 PM
Component/s: Engine
Affects Version/s: 2.5.0, 2.5.1, 2.5.2, 2.5.2 Update 1
Fix Version/s: 2.5.3

Issue Links:
Relate
 

QA Status: Done successfully


 Description  « Hide
Consider following procedure:

CREATE OR ALTER PROCEDURE HIDDEN_VARS
  RETURNS (OUT_A INT, OUT_B1 INT, OUT_B2 INT)
AS
DECLARE A INT;
DECLARE C CURSOR FOR
  (SELECT COALESCE( (SELECT COUNT(*) FROM RDB$RELATIONS), -1) FROM RDB$DATABASE);
DECLARE B INT = 0;
BEGIN
  OUT_B1 = B;

  OPEN C;
  FETCH C INTO :A;
  CLOSE C;

  OUT_A = A;
  OUT_B2 = B;
  B = B + 1;
  SUSPEND;
END

Results of first execution:

OUT_A OUT_B1 OUT_B2
353 0 353

Variable B was changed when cursor was fetched !

Second and all subsequent executions:

OUT_A OUT_B1 OUT_B2
353 354 353

Value of variable B keeped after procedure execution !


 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Vlad Khorsun made changes - 22/Sep/13 10:41 AM
Field Original Value New Value
Assignee Vlad Khorsun [ hvlad ]
Vlad Khorsun made changes - 22/Sep/13 12:03 PM
Affects Version/s 2.5.2 [ 10450 ]
Affects Version/s 2.5.1 [ 10333 ]
Affects Version/s 2.5.0 [ 10221 ]
Vlad Khorsun made changes - 22/Sep/13 12:36 PM
Status Open [ 1 ] Resolved [ 5 ]
Fix Version/s 2.5.3 [ 10461 ]
Resolution Fixed [ 1 ]
Pavel Zotov made changes - 29/May/15 04:54 PM
Status Resolved [ 5 ] Resolved [ 5 ]
QA Status Done successfully
Pavel Cisar made changes - 25/Sep/15 01:09 PM
Link This issue is related to QA-608 [ QA-608 ]