Skip to content

Do not convert pattern literals of LIKE, CONTAINING, STARTING WITH and SIMILAR TO to the operand type - #9185

Open
madorin wants to merge 1 commit into
FirebirdSQL:masterfrom
madorin:fix-pattern-literal-conversion
Open

madorin wants to merge 1 commit into
FirebirdSQL:masterfrom
madorin:fix-pattern-literal-conversion

Conversation

@madorin

@madorin madorin commented Oct 3, 2026 •

Copy link
Copy Markdown

Fixes #9186

#9108 converts a string literal to the type of the other operand at prepare time for every ComparativeBoolNode. For the pattern matching operators the literal is a pattern matched against the text form of the operand, so date_col LIKE '2024%', time_col LIKE '10%', double_col LIKE '3%' etc. failed with a conversion error. Patterns that happen to be valid literals (date_col LIKE '5-SEP-2024') matched values they shouldn't.

The conversion is now done only for =, <>, <, <=, >, >=, IS [NOT] DISTINCT FROM and BETWEEN.

Tested on a debug build of master with the queries from the issue: they give the same results as 5.0. Comparisons such as d = 'garbage' and d between 'x' and 'y' still fail at prepare, so the #9108 conversion is still applied to them.

Comment thread src/dsql/BoolNodes.cpp
if (blrOp == blr_between)
convertLiteralToOperand(procArg3, procArg1);
break;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd also add all the pattern matching BLRs to the switch (with just break;) and the default section with fb_assert(false). This would trigger an explicit decision how any newly added BLR comparison op-code should be preprocessed in this routine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LIKE, CONTAINING, STARTING WITH and SIMILAR TO fail on DATE/TIME/TIMESTAMP and approximate numeric operands since #9108

2 participants