Regression: MERGE fails with violation of PK./UK on target <T> when source <S> 
contains two rows with similar key for PK and join condition is <S>.pk_field = 
<T>.pk_field
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------

                 Key: CORE-4796
                 URL: http://tracker.firebirdsql.org/browse/CORE-4796
             Project: Firebird Core
          Issue Type: Bug
          Components: Engine
    Affects Versions: 3.0 Beta 2
            Reporter: Pavel Zotov


WI-T3.0.0.31839:
=============
SQL> create table tdetl(id int constraint tdetl_pk primary key, pid int); 
commit;
SQL> set count on;
SQL> merge into tdetl t using ( select 5 as id, 1 as pid from rdb$types rows 2 
) s 
CON> on t.id=s.id 
CON> when matched then update set t.pid = s.pid 
CON> when not matched then insert values( s.id, s.pid);
Statement failed, SQLSTATE = 23000
violation of PRIMARY or UNIQUE KEY constraint "TDETL_PK" on table "TDETL"
-Problematic key value is ("ID" = 5)
Records affected: 1

WI-V2.5.5.26870:
=============
SQL> set count on;
SQL> merge into tdetl t using ( select 5 as id, 1 as pid from rdb$types rows 2 
) s on t.id=s.id when matched then update set t.pid
 = s.pid when not matched then insert values( s.id, s.pid);
Records affected: 1
SQL> select * from tdetl;

          ID          PID
============ ============
           5            1

Records affected: 1
SQL>

-- 
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

        

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to