Repository navigation
Commit a7dc477
authored
## Summary
This PR makes the `REGEXP` and `RLIKE` operators and `REGEXP_LIKE()`
behave much more like MySQL. It brings the failures in the
`REGEXP_LIKE()` test suite from #622 down **from 1,253 to 766** (MySQL
cases: 302 → 262, ICU cases: 951 → 504, on PHP 8.5).
It's the first PRs that split #368 into smaller chunks.
The main changes:
- **Unicode text** is matched by character, so `.` matches `é`, and
case-insensitive matching works beyond ASCII.
- **Binary data** that isn't valid UTF-8 is matched byte by byte, like
in MySQL.
- **Errors** are raised for invalid patterns, instead of PHP warnings or
silently wrong results.
- **Line breaks, escaped slashes, big integers, and operator
precedence** work like in MySQL.
- **Long subjects** no longer fail on PHP's small JIT stack.
## Why
Apps use `REGEXP` with Unicode text, binary data, and big numbers, and
the old matching often got these wrong. The functions in the next PR
also need this engine.
## Upgrade note
A `CHECK` constraint or `DEFAULT` expression with `REGEXP BINARY`,
created before this change, can reject valid rows until its table is
rebuilt, for example by adding a column. This should be rare, because
MySQL rejects `REGEXP BINARY` on text.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->
## Summary by CodeRabbit
* **Bug Fixes**
* Improved compatibility for `REGEXP`, `RLIKE`, and `REGEXP_LIKE`
queries, including pattern flags, escaped characters, numeric values,
and Unicode or binary data.
* Corrected handling of `NULL` values and invalid patterns or match
types.
* Improved behavior for complex patterns that reach matching limits.
* Corrected operator precedence and matching behavior for patterns
containing null bytes, newlines, or large numeric values.
* Improved consistency when matching patterns with multiple flags or
unusual character encodings.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent deafe5d commit a7dc477
4 files changed
Lines changed: 986 additions & 789 deletions
File tree
- packages/mysql-on-sqlite
- src/sqlite
- tests
- regexp
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4431 | 4431 | | |
4432 | 4432 | | |
4433 | 4433 | | |
| 4434 | + | |
| 4435 | + | |
| 4436 | + | |
| 4437 | + | |
| 4438 | + | |
| 4439 | + | |
| 4440 | + | |
4434 | 4441 | | |
4435 | 4442 | | |
4436 | 4443 | | |
4437 | 4444 | | |
4438 | | - | |
4439 | | - | |
4440 | 4445 | | |
4441 | 4446 | | |
4442 | 4447 | | |
| |||
5154 | 5159 | | |
5155 | 5160 | | |
5156 | 5161 | | |
5157 | | - | |
| 5162 | + | |
| 5163 | + | |
5158 | 5164 | | |
5159 | 5165 | | |
5160 | 5166 | | |
5161 | | - | |
5162 | | - | |
| 5167 | + | |
| 5168 | + | |
5163 | 5169 | | |
| 5170 | + | |
| 5171 | + | |
| 5172 | + | |
5164 | 5173 | | |
5165 | 5174 | | |
5166 | | - | |
5167 | | - | |
5168 | | - | |
| 5175 | + | |
| 5176 | + | |
5169 | 5177 | | |
5170 | | - | |
5171 | | - | |
| 5178 | + | |
| 5179 | + | |
5172 | 5180 | | |
5173 | | - | |
5174 | | - | |
5175 | | - | |
5176 | | - | |
| 5181 | + | |
5177 | 5182 | | |
5178 | | - | |
5179 | | - | |
5180 | | - | |
5181 | | - | |
| 5183 | + | |
5182 | 5184 | | |
5183 | 5185 | | |
5184 | 5186 | | |
| |||
5393 | 5395 | | |
5394 | 5396 | | |
5395 | 5397 | | |
| 5398 | + | |
| 5399 | + | |
| 5400 | + | |
| 5401 | + | |
| 5402 | + | |
| 5403 | + | |
| 5404 | + | |
5396 | 5405 | | |
5397 | 5406 | | |
5398 | 5407 | | |
| |||
0 commit comments