[ 
https://issues.apache.org/jira/browse/TRAFODION-3000?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16405576#comment-16405576
 ] 

David Wayne Birdsall commented on TRAFODION-3000:
-------------------------------------------------

The bug is in the index maintenance in-lining code in the Binder. For MERGE 
DELETE, since there is no "when not matched" clause here, it is a simple delete 
without any insert or update. Therefore there is no need to create a record 
descriptor for new values. The code correctly avoids doing that. A later 
section of code, however, incorrectly assumed that such a descriptor existed. 
That code should have instead referred to the record descriptor for old values. 

> MERGE DELETE on table with unique index fails with error 4002
> -------------------------------------------------------------
>
>                 Key: TRAFODION-3000
>                 URL: https://issues.apache.org/jira/browse/TRAFODION-3000
>             Project: Apache Trafodion
>          Issue Type: Bug
>          Components: sql-cmp
>    Affects Versions: 2.3
>            Reporter: David Wayne Birdsall
>            Assignee: David Wayne Birdsall
>            Priority: Major
>
> The following session illustrates the problem:
> {{>>drop table if exists t1 cascade;}}
> {{--- SQL operation complete.}}
> {{>>}}
> {{>>create table t1 (c1 int not null, c2 int, primary key (c1), unique 
> (c2));}}
> {{--- SQL operation complete.}}
> {{>>insert into t1 values (1,1),(2,2),(3,3);}}
> {{--- 3 row(s) inserted.}}
> {{>>}}
> {{>>merge into t1 on c2=1 when matched then delete;}}
> {{*** ERROR[4002] Column "NEW@".C2 is not found. Table "NEW@" not exposed. 
> Tables in scope: "OLD@". Default schema: TRAFODION.SEABASE.}}
> {{*** ERROR[8822] The statement was not prepared.}}
> {{>>}}
> If the "unique" constraint is absent in the CREATE TABLE statement, the MERGE 
> statement completes successfully.
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to