Issue Details (XML | Word | Printable)

Key: CORE-2117
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Adriano dos Santos Fernandes
Reporter: Adriano dos Santos Fernandes
Votes: 0
Watchers: 0
Operations

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

Incorrect ROW_COUNT value with indexed retrieval and subquery

Created: 11/Oct/08 12:21 PM   Updated: 19/Jan/16 06:05 AM
Component/s: Engine
Affects Version/s: 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.5 Initial, 2.1.0, 2.0.4, 2.5 Alpha 1, 2.1.1
Fix Version/s: 2.1.2, 2.5 Beta 1

Issue Links:
Relate
 

QA Status: Done successfully


 Description  « Hide
Test case:

create table t (n integer);

insert into t values (1);
insert into t values (2);
insert into t values (3);

commit;

create index t_n on t (n);

set term !;

execute block returns (n integer)
as
  declare x integer;
begin
  update t set n = n where n = -1;
  n = row_count;
  suspend;

  update t set n = n where n = (select -1 from rdb$database);
  n = row_count;
  suspend;

  update t set n = n where n = -1;
  n = row_count;
  suspend;

  for select 1 from t where n = -1 into x do
  begin
  end
  n = row_count;
  suspend;

  for select 1 from t where n = (select -1 from rdb$database) into x do
  begin
  end
  n = row_count;
  suspend;

  delete from t where n = (select -1 from rdb$database);
  n = row_count;
  suspend;
end!

set term ;!

Returns:
0
1
0
0
1
1

Should return:
0
0
0
0
0
0


 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Adriano dos Santos Fernandes made changes - 11/Oct/08 12:21 PM
Field Original Value New Value
Assignee Adriano dos Santos Fernandes [ asfernandes ]
Adriano dos Santos Fernandes made changes - 11/Oct/08 12:28 PM
Description Test case:

create table t (n integer);

insert into t values (1);
insert into t values (2);
insert into t values (3);

commit;

create index t_n on t (n);

set term !;

execute block returns (n integer)
as
  declare x integer;
begin
  update t set n = n where n = 1;
  n = row_count;
  suspend;

  update t set n = n where n = (select 1 from rdb$database);
  n = row_count;
  suspend;

  update t set n = n where n = 1;
  n = row_count;
  suspend;

  for select 1 from t where n = 1 into x do
  begin
  end
  n = row_count;
  suspend;

  for select 1 from t where n = (select 1 from rdb$database) into x do
  begin
  end
  n = row_count;
  suspend;

  delete from t where n = (select 1 from rdb$database);
  n = row_count;
  suspend;
end!

set term ;!

Returns:
0
1
0
0
1
1

Should return:
0
0
0
0
0
0
Test case:

create table t (n integer);

insert into t values (1);
insert into t values (2);
insert into t values (3);

commit;

create index t_n on t (n);

set term !;

execute block returns (n integer)
as
  declare x integer;
begin
  update t set n = n where n = -1;
  n = row_count;
  suspend;

  update t set n = n where n = (select -1 from rdb$database);
  n = row_count;
  suspend;

  update t set n = n where n = -1;
  n = row_count;
  suspend;

  for select 1 from t where n = -1 into x do
  begin
  end
  n = row_count;
  suspend;

  for select 1 from t where n = (select -1 from rdb$database) into x do
  begin
  end
  n = row_count;
  suspend;

  delete from t where n = (select -1 from rdb$database);
  n = row_count;
  suspend;
end!

set term ;!

Returns:
0
1
0
0
1
1

Should return:
0
0
0
0
0
0
Adriano dos Santos Fernandes made changes - 11/Oct/08 12:39 PM
Fix Version/s 2.1.2 [ 10270 ]
Fix Version/s  2.5 Beta 1 [ 10251 ]
Resolution Fixed [ 1 ]
Status Open [ 1 ] Resolved [ 5 ]
Philippe Makowski made changes - 26/Dec/08 10:43 AM
Link This issue block progress on QA-226 [ QA-226 ]
Philippe Makowski made changes - 26/Dec/08 11:01 AM
Status Resolved [ 5 ] Closed [ 6 ]
Pavel Cisar made changes - 26/Jan/09 08:17 AM
Link This issue is related to QA-226 [ QA-226 ]
Pavel Cisar made changes - 26/Jan/09 08:29 AM
Link This issue block progress on QA-226 [ QA-226 ]
Pavel Zotov made changes - 19/Jan/16 04:46 AM
QA Status No test
Pavel Zotov made changes - 19/Jan/16 06:05 AM
QA Status No test Done successfully