From 68ec92733ca9317642a829318fbd043fc05754b8 Mon Sep 17 00:00:00 2001 From: Adriano dos Santos Fernandes Date: Wed, 4 May 2022 22:09:02 -0300 Subject: [PATCH] Fix #7176 - Incorrect error "Invalid token. Malformed string." with union + blob + non utf8 varchar. --- src/dsql/pass1.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/dsql/pass1.cpp b/src/dsql/pass1.cpp index 384208ee55..fcb1cc82bf 100644 --- a/src/dsql/pass1.cpp +++ b/src/dsql/pass1.cpp @@ -2761,16 +2761,11 @@ static void pass1_union_auto_cast(DsqlCompilerScratch* dsqlScratch, ExprNode* in field->length = desc.dsc_length; field->flags = (desc.dsc_flags & DSC_nullable) ? FLD_nullable : 0; - if (desc.dsc_dtype <= dtype_any_text) + if (desc.isText() || desc.isBlob()) { - field->textType = desc.dsc_sub_type; - field->charSetId = INTL_GET_CHARSET(&desc); - field->collationId = INTL_GET_COLLATE(&desc); - } - else if (desc.dsc_dtype == dtype_blob) - { - field->charSetId = desc.dsc_scale; - field->collationId = desc.dsc_flags >> 8; + field->textType = desc.getTextType(); + field->charSetId = desc.getCharSet(); + field->collationId = desc.getCollation(); } // Finally copy the descriptors to the root nodes and swap