From d30e21467ac7ce02ea1b1f38280b6d33bc554b9a Mon Sep 17 00:00:00 2001 From: Dorin Marcoci Date: Sat, 3 Oct 2026 18:51:31 +0300 Subject: [PATCH] Do not convert pattern literals of LIKE, CONTAINING, STARTING WITH and SIMILAR TO to the operand type --- src/dsql/BoolNodes.cpp | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/src/dsql/BoolNodes.cpp b/src/dsql/BoolNodes.cpp index fd84e9af226..d73377259d6 100644 --- a/src/dsql/BoolNodes.cpp +++ b/src/dsql/BoolNodes.cpp @@ -486,11 +486,33 @@ BoolExprNode* ComparativeBoolNode::dsqlPass(DsqlCompilerScratch* dsqlScratch) literalArg = value; }; - convertLiteralToOperand(procArg1, procArg2); - convertLiteralToOperand(procArg2, procArg1); + // Pattern matching operators (LIKE, CONTAINING, etc) compare strings, so their literals are kept as is + switch (blrOp) + { + case blr_eql: + case blr_neq: + case blr_gtr: + case blr_geq: + case blr_lss: + case blr_leq: + case blr_equiv: + case blr_between: + convertLiteralToOperand(procArg1, procArg2); + convertLiteralToOperand(procArg2, procArg1); - if (blrOp == blr_between) - convertLiteralToOperand(procArg3, procArg1); + if (blrOp == blr_between) + convertLiteralToOperand(procArg3, procArg1); + break; + + case blr_containing: + case blr_like: + case blr_similar: + case blr_starting: + break; + + default: + fb_assert(false); + } ComparativeBoolNode* node = FB_NEW_POOL(dsqlScratch->getPool()) ComparativeBoolNode(dsqlScratch->getPool(), blrOp, procArg1,