[ https://issues.apache.org/jira/browse/DERBY-6032?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Bryan Pendleton reassigned DERBY-6032: -------------------------------------- Assignee: Kasun Prabath Amarasinghe > 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.7.1.1, 10.8.1.2, 10.8.2.2, 10.8.3.0, 10.9.1.0, > 10.10.1.1 > Reporter: Knut Anders Hatlen > Assignee: Kasun Prabath Amarasinghe > Labels: derby_triage10_11 > > 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 was sent by Atlassian JIRA (v6.4.14#64029)