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

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

The bug seems to be in ZZZBinderFunction::bindNode 
(optimizer/BindItemExpr.cpp). The code that processes RIGHT converts it to a 
SUBSTR as follows:

        if ( getOperatorType() == ITM_RIGHT )
          strcpy(buf, "SUBSTRING(@A1 FROM (CHAR_LENGTH(@A1) - CAST(@A2 AS INT 
UNSIGNED) + 1));");

Now, the question is, is this the correct semantic? Perhaps there should be a 
CASE statement that uses 1 if the expression is less than 1. I am trying to 
locate a recent copy of the ANSI standard to see.

> RIGHT function gives incorrect answer on UTF-8 varchars sometimes
> -----------------------------------------------------------------
>
>                 Key: TRAFODION-2559
>                 URL: https://issues.apache.org/jira/browse/TRAFODION-2559
>             Project: Apache Trafodion
>          Issue Type: Bug
>          Components: sql-general
>    Affects Versions: 2.1-incubating, 2.2-incubating
>            Reporter: David Wayne Birdsall
>            Assignee: David Wayne Birdsall
>




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

Reply via email to