diff --git a/src/dsql/ExprNodes.cpp b/src/dsql/ExprNodes.cpp index ecbd6c835f..fc70d4070d 100644 --- a/src/dsql/ExprNodes.cpp +++ b/src/dsql/ExprNodes.cpp @@ -13545,6 +13545,7 @@ ValueExprNode* ValueIfNode::dsqlPass(DsqlCompilerScratch* dsqlScratch) doDsqlPass(dsqlScratch, condition), doDsqlPass(dsqlScratch, trueValue), doDsqlPass(dsqlScratch, falseValue)); + node->dsqlGenCast = dsqlGenCast; PASS1_set_parameter_type(dsqlScratch, node->trueValue, node->falseValue, false); PASS1_set_parameter_type(dsqlScratch, node->falseValue, node->trueValue, false); @@ -13568,8 +13569,12 @@ void ValueIfNode::genBlr(DsqlCompilerScratch* dsqlScratch) { dsc desc; make(dsqlScratch, &desc); - dsqlScratch->appendUChar(blr_cast); - GEN_descriptor(dsqlScratch, &desc, true); + + if (dsqlGenCast) + { + dsqlScratch->appendUChar(blr_cast); + GEN_descriptor(dsqlScratch, &desc, true); + } dsqlScratch->appendUChar(blr_value_if); GEN_expr(dsqlScratch, condition); diff --git a/src/dsql/ExprNodes.h b/src/dsql/ExprNodes.h index 9f763f9ada..dfe5aaa3f8 100644 --- a/src/dsql/ExprNodes.h +++ b/src/dsql/ExprNodes.h @@ -2220,6 +2220,7 @@ public: NestConst condition; NestConst trueValue; NestConst falseValue; + bool dsqlGenCast = true; }; diff --git a/src/dsql/parse.y b/src/dsql/parse.y index c634dc3b42..17e0b6f7e0 100644 --- a/src/dsql/parse.y +++ b/src/dsql/parse.y @@ -8712,6 +8712,8 @@ searched_when_clause | searched_when_clause WHEN search_condition THEN case_result { ValueIfNode* cond = newNode($3, $5, NullNode::instance()); + cond->dsqlGenCast = false; + ValueIfNode* last = $1; ValueIfNode* next;