Wrong data type cast in UNION ALL cause Invalid ASCII bytestream exception

Details

Detail name Value
Changelog Number 7909
Type Bug
Status Open
Affected Versions Exasol 6.1.0

Problem Description

If a UNION ALL expression contains a VARCHAR column using UTF-8 encoding (which is the default encoding), and that column actually contains values with non-ASCII characters, then a query containing an equality filter on that column may fail with an "Invalid ASCII bytestream" exception.

Example:
create table t (
      a varchar(100) utf8
);  

insert into t(a) 
values(
    'xxx?'
);

create or replace view uv as
table t
    union all 
table t;

Following statement throws "Invalid ASCII bytestream"  exception:

select * from uv where a = 'xxx';

Workaround:

Use an explicit type cast for the column filter:

select * from uv where cast(a as varchar(100) utf8) = 'xxx';