You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafodion.apache.org by "David Wayne Birdsall (JIRA)" <ji...@apache.org> on 2017/03/28 21:07:41 UTC

[jira] [Commented] (TRAFODION-2559) RIGHT function gives incorrect answer on UTF-8 varchars sometimes

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

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

The following script demonstrates the problem:

create table test(a int, b varchar(6) character set utf8);

insert into test values(2,'abcdef'),(4,'abcdef'),(6,'abcdef'),(7,'abcdef'),(9,'abcdef'),(12,'abcdef'),(15,'abcdef');

select * from test;

select right(b,a) from test;

When executed, the selects return:

>>select * from test;

A            B                       
-----------  ------------------------

          2  abcdef                  
          4  abcdef                  
          6  abcdef                  
          7  abcdef                  
          9  abcdef                  
         12  abcdef                  
         15  abcdef                  

--- 7 row(s) selected.
>>
>>select right(b,a) from test;

(EXPR)                  
------------------------

ef                      
cdef                    
abcdef                  
abcde                   
abc                     
                        
                        

--- 7 row(s) selected.

The answers in the second select are incorrect when A > 6.

The problem only seems to happen with UTF-8. Using ISO88591 and UCS2, similar scripts show the correct answers.

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