Issue Details (XML | Word | Printable)

Key: CORE-4400
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: Pavel Zotov
Votes: 1
Watchers: 2
Operations

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

MERGE set ROW_COUNT to 1 when number of handled records more than 1

Created: 23/Apr/14 02:16 PM   Updated: 23/Apr/14 02:16 PM
Component/s: None
Affects Version/s: None
Fix Version/s: None


 Description  « Hide
SQL> create sequence g;
SQL> recreate table t1(id int primary key using index t1_pk, x int);
SQL> recreate table t2(id int primary key using index t2_pk, x int);
SQL> commit;
SQL>
SQL> insert into t1 select gen_id(g,1), rand()*100 from rdb$types rows 10;
SQL> commit;
SQL>
SQL> alter sequence g restart with 0;
SQL> commit;
SQL>
SQL> insert into t2 select gen_id(g,1), rand()*100 from rdb$types rows 50;
SQL> commit;
SQL>
SQL> set term ^;
SQL> execute block returns(processed_rows int) as
CON> begin
CON> merge into t1 t using t2 s on t.id=s.id
CON> when MATCHED then update set t.x=t.x+s.x
CON> when NOT matched then insert values(s.id, s.x);
CON> processed_rows = row_count;
CON> suspend;
CON> end
CON> ^set term ;^

PROCESSED_ROWS
==============
             1

But:
===
SQL> select count(*) from t1;

       COUNT
============
          50 -- (10 rows updated and 40 rows added)

Tested on:
LI-V2.5.3.26744
LI-T3.0.0.31071

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
There are no comments yet on this issue.