8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 16:03:03 +01:00

Fix #7600 - CASE statement different result compared to FB 2.5.9. (#7602)

This commit is contained in:
Adriano dos Santos Fernandes 2023-09-19 00:03:30 +00:00 committed by GitHub
parent f8ed006057
commit fc2fe39d3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 2 deletions

View File

@ -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);

View File

@ -2220,6 +2220,7 @@ public:
NestConst<BoolExprNode> condition;
NestConst<ValueExprNode> trueValue;
NestConst<ValueExprNode> falseValue;
bool dsqlGenCast = true;
};

View File

@ -8712,6 +8712,8 @@ searched_when_clause
| searched_when_clause WHEN search_condition THEN case_result
{
ValueIfNode* cond = newNode<ValueIfNode>($3, $5, NullNode::instance());
cond->dsqlGenCast = false;
ValueIfNode* last = $1;
ValueIfNode* next;