Fix CURRENT_SCHEMA, CURRENT_USER and CURRENT_CLUSTER datatype

Details

Detail name Value
Changelog Number 19716
Type Bug
Status Resolved
Affected Versions Exasol 7.1.0, Exasol 8.0.0
Fix Versions Exasol 7.1.27, Exasol 8.27.0
Resolution Date 2024-05-02

Description

  1. The length of the returned datatype of the functions CURRENT_SCHEMA, CURRENT_USER and CURRENT_CLUSTER is the length of the returned string, not the maximum possible length of an identifier. This could cause problems for virtual schemas if the function is pushed down and the returned string is longer than when the function is evaluated locally.
  2. The character set of the returned datatype of CURRENT_SCHEMA and CURRENT_CLUSTER is always ASCII, even if the returned string has non-ASCII characters. This is a bug as shown in the example below. It could also cause problems for virtual schemas if the function is pushed down and the returned string has non-ASCII characters.

Example

-- Setup
-- Create schema with non-ASCII name
create schema PRÜFUNG;
create table TEST_CURRENT_SCHEMA as select current_schema as S;

-- Expected: Datatype of column S is "VARCHAR(128) UTF8"
-- Observed: Datatype of column S is "VARCHAR(8) ASCII"
describe TEST_CURRENT_SCHEMA;

-- Expected: Success
-- Observed: Error "data exception - Wrong character, argument should be ascii-character in write of column TEST_CURRENT_SCHEMA.S"
insert into TEST_CURRENT_SCHEMA select cast(S as varchar(128) utf8) from TEST_CURRENT_SCHEMA;

Workaround

There is no workaround.

Fix

These functions are changed so that they always return the “maximal” datatype for an identifier of 128 characters length and UTF8 character set.

Changed behavior

The datatype returned by CURRENT_SCHEMA, CURRENT_USER and CURRENT_CLUSTER is changed to "maximal": 128 characters length and UTF8 character set.