db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Knut Anders Hatlen (JIRA)" <j...@apache.org>
Subject [jira] [Created] (DERBY-6032) Concatenation operator confuses collation
Date Thu, 03 Jan 2013 13:02:12 GMT
Knut Anders Hatlen created DERBY-6032:
-----------------------------------------

             Summary: Concatenation operator confuses collation
                 Key: DERBY-6032
                 URL: https://issues.apache.org/jira/browse/DERBY-6032
             Project: Derby
          Issue Type: Bug
          Components: SQL
    Affects Versions: 10.9.1.0
            Reporter: Knut Anders Hatlen


Given this table:

ij> connect 'jdbc:derby:memory:db;territory=en;collation=TERRITORY_BASED;create=true';
ij> create table t(x varchar(10));
0 rows inserted/updated/deleted
ij> insert into t values 'a' || 'b';
1 row inserted/updated/deleted

The following query works:

ij> select * from t where x = 'ab';
X         
----------
ab        

1 row selected

However, if the string is generated with the concatenation operator, an exception is thrown:

ij> select * from t where x = 'a' || 'b';
ERROR 42818: Comparisons between 'VARCHAR (TERRITORY_BASED)' and 'CHAR (UCS_BASIC)' are not
supported. Types must be comparable. String types must also have matching collation. If collation
does not match, a possible solution is to cast operands to force them to the default collation
(e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')

I'd expect the two queries to be equivalent.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message