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

                 Key: CORE-4400
                 URL: http://tracker.firebirdsql.org/browse/CORE-4400
             Project: Firebird Core
          Issue Type: Bug
            Reporter: Pavel Zotov


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

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to