From 3e941342a2ff62be7f6ab4cccb127f3d52345873 Mon Sep 17 00:00:00 2001 From: "Dan S. Camper" Date: Fri, 19 Apr 2024 13:04:40 -0500 Subject: [PATCH] Coerce more REGEX arguments to explicit types --- ecl/hql/hqlgram.y | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/ecl/hql/hqlgram.y b/ecl/hql/hqlgram.y index 7990376f49c..13540cf98f2 100644 --- a/ecl/hql/hqlgram.y +++ b/ecl/hql/hqlgram.y @@ -6443,11 +6443,20 @@ primexpr1 parser->normalizeExpression($3, type_stringorunicode, false); parser->checkRegex($3); if(isUTF8Type($3.queryExprType())) + { + parser->normalizeExpression($3, type_utf8, false); parser->normalizeExpression($5, type_utf8, false); + } else if(isUnicodeType($3.queryExprType())) + { + parser->normalizeExpression($3, type_unicode, false); parser->normalizeExpression($5, type_unicode, false); + } else + { + parser->normalizeExpression($3, type_string, false); parser->normalizeExpression($5, type_string, false); + } $$.setExpr(createValue(no_regex_find, makeBoolType(), $3.getExpr(), $5.getExpr(), $6.getExpr())); } | REGEXFIND '(' expression ',' expression ',' expression regexOpt ')' @@ -6457,16 +6466,19 @@ primexpr1 Owned subType; if(isUTF8Type($3.queryExprType())) { + parser->normalizeExpression($3, type_utf8, false); parser->normalizeExpression($5, type_utf8, false); subType.setown(makeUtf8Type(UNKNOWN_LENGTH, 0)); } else if(isUnicodeType($3.queryExprType())) { + parser->normalizeExpression($3, type_unicode, false); parser->normalizeExpression($5, type_unicode, false); subType.setown(makeUnicodeType(UNKNOWN_LENGTH, 0)); } else { + parser->normalizeExpression($3, type_string, false); parser->normalizeExpression($5, type_string, false); subType.setown(makeStringType(UNKNOWN_LENGTH)); } @@ -6480,16 +6492,19 @@ primexpr1 Owned retType; if(isUTF8Type($3.queryExprType())) { + parser->normalizeExpression($3, type_utf8, false); parser->normalizeExpression($5, type_utf8, false); retType.setown(makeUtf8Type(UNKNOWN_LENGTH, $3.queryExprType()->queryLocale())); } else if(isUnicodeType($3.queryExprType())) { + parser->normalizeExpression($3, type_unicode, false); parser->normalizeExpression($5, type_unicode, false); retType.setown(makeUnicodeType(UNKNOWN_LENGTH, $3.queryExprType()->queryLocale())); } else { + parser->normalizeExpression($3, type_string, false); parser->normalizeExpression($5, type_string, false); retType.setown(makeStringType(UNKNOWN_LENGTH)); } @@ -6502,18 +6517,21 @@ primexpr1 Owned retType; if(isUTF8Type($3.queryExprType())) { + parser->normalizeExpression($3, type_utf8, false); parser->normalizeExpression($5, type_utf8, false); parser->normalizeExpression($7, type_utf8, false); retType.setown(makeUtf8Type(UNKNOWN_LENGTH, 0)); } else if(isUnicodeType($3.queryExprType())) { + parser->normalizeExpression($3, type_unicode, false); parser->normalizeExpression($5, type_unicode, false); parser->normalizeExpression($7, type_unicode, false); retType.setown(makeUnicodeType(UNKNOWN_LENGTH, 0)); } else { + parser->normalizeExpression($3, type_string, false); parser->normalizeExpression($5, type_string, false); parser->normalizeExpression($7, type_string, false); retType.setown(makeStringType(UNKNOWN_LENGTH));