Skip to content

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

Merged
dyemanov merged 1 commit into
FirebirdSQL:masterfrom
madorin:fix-pattern-literal-conversion
Oct 5, 2026
Merged

dyemanov merged 1 commit into
FirebirdSQL:masterfrom
madorin:fix-pattern-literal-conversion

Conversation

@madorin

@madorin madorin commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done: the pattern matching ops are now listed with just break, and default has fb_assert(false).

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.

blr_matching and blr_matching2 are missing here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added. These come only from GPRE/GDML BLR, so they never reach dsqlPass, but they're listed now for completeness.

@madorin
madorin force-pushed the fix-pattern-literal-conversion branch from 8be5575 to d30e214 Compare October 4, 2026 17:55
@madorin
madorin force-pushed the fix-pattern-literal-conversion branch from d30e214 to fab0ec6 Compare October 5, 2026 06:15
@dyemanov
dyemanov merged commit 1e316df into FirebirdSQL:master Oct 5, 2026
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