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

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

Debugging this leads to the following code in generator/GenRelUpdate.cpp:

  else if (getIndexDesc()->isClusteringIndex() && 
getCheckConstraints().entries())
    {
      GenAssert(FALSE, "Should not reach here. This update should have been 
transformed to delete/insert");
      // To be uncommented when TRAFODION-1610 is implemented
      // Need to generate insConstraintExpr also
/*
      ItemExpr *constrTree =
        getCheckConstraints().rebuildExprTree(ITM_AND, TRUE, TRUE);

      if (getTableDesc()->getNATable()->hasSerializedEncodedColumn())
        constrTree = generator->addCompDecodeForDerialization(constrTree);

      expGen->generateExpr(constrTree->getValueId(), ex_expr::exp_SCAN_PRED,
                            &updConstraintExpr);
*/
    }

So, it appears the fix to JIRA TRAFODION-1610 will fix this problem also. Or at 
the very least is necessary to fix this problem.


> Merge returns internal error when the table has a constraint
> ------------------------------------------------------------
>
>                 Key: TRAFODION-2630
>                 URL: https://issues.apache.org/jira/browse/TRAFODION-2630
>             Project: Apache Trafodion
>          Issue Type: Bug
>          Components: sql-cmp
>    Affects Versions: 2.2-incubating
>         Environment: Reproduced this on a workstation; I suspect it will 
> happen in any environment.
>            Reporter: David Wayne Birdsall
>            Assignee: David Wayne Birdsall
>
> Consider the following script:
> create table mytable1 (a int not null not droppable primary key, b int, c 
> int);
> insert into mytable1 values (1,1,1),(2,2,2),(3,3,3);
> merge into mytable1 on a=1 when matched then update set c=100;
> create table mytable2 (a int not null not droppable primary key, b int, c 
> int, check (b > 0));
> insert into mytable2 values (1,1,1),(2,2,2),(3,3,3);
> merge into mytable2 on a=1 when matched then update set c=100;
> When this script is executed, the first MERGE statement executes normally but 
> the second fails as follows:
> >>merge into mytable2 on a=1 when matched then update set c=100;
> *** ERROR[7000] An internal error occurred in the code generator in file 
> ../generator/GenRelUpdate.cpp at line 1721: Should not reach here. This 
> update should have been transformed to delete/insert.
> *** ERROR[2235] Compiler Internal Error: An unknown error, originated from 
> file ../generator/Generator.cpp at line 3065.
> *** ERROR[8822] The statement was not prepared.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to