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

MERGE set ROW_COUNT to 1 when number of handled records more than 1 [CORE4400] #4722

Open
firebird-issue-importer opened this issue Apr 23, 2014 · 0 comments

Comments

@firebird-issue-importer

Submitted by: @pavel-zotov

Votes: 1

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 http://t.id=s.id
CON> when MATCHED then update set t.x=t.x+s.x
CON> when NOT matched then insert values(http://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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant