Description:
Under `NO_BACKSLASH_ESCAPES`, a `REGEXP` predicate whose pattern uses a backslash character-class escape (`\w \d \s \W \S \D`) returns wrong (missing) row when the filtered relation is a `UNION ALL` derived table (or a view built on one).
The same predicate over the base table, or over a plain (non-`UNION`) derived table, matches correctly.
How to repeat:
## Environment
- **Version:** `VERSION()` = `26.7.0-debug` (MySQL `main`, commit `@06a5c1c9`, assertions on)
- **`sql_mode`:** must include `NO_BACKSLASH_ESCAPES` (see note below)
- **`character_set_connection`:** `utf8mb4`
- **`collation_connection`:** `utf8mb4_0900_bin`
Minimal repro
```sql
SET SESSION sql_mode = 'NO_BACKSLASH_ESCAPES';
CREATE TABLE t (name VARCHAR(255));
INSERT INTO t VALUES ('a');
-- Expected 1 row, actual 1 row (correct):
SELECT name FROM t WHERE name REGEXP '\w';
-- Expected 1 row, actual 0 rows (WRONG):
SELECT name FROM (SELECT * FROM t UNION ALL SELECT * FROM t WHERE 0) x WHERE name REGEXP '\w';
```
Description: Under `NO_BACKSLASH_ESCAPES`, a `REGEXP` predicate whose pattern uses a backslash character-class escape (`\w \d \s \W \S \D`) returns wrong (missing) row when the filtered relation is a `UNION ALL` derived table (or a view built on one). The same predicate over the base table, or over a plain (non-`UNION`) derived table, matches correctly. How to repeat: ## Environment - **Version:** `VERSION()` = `26.7.0-debug` (MySQL `main`, commit `@06a5c1c9`, assertions on) - **`sql_mode`:** must include `NO_BACKSLASH_ESCAPES` (see note below) - **`character_set_connection`:** `utf8mb4` - **`collation_connection`:** `utf8mb4_0900_bin` Minimal repro ```sql SET SESSION sql_mode = 'NO_BACKSLASH_ESCAPES'; CREATE TABLE t (name VARCHAR(255)); INSERT INTO t VALUES ('a'); -- Expected 1 row, actual 1 row (correct): SELECT name FROM t WHERE name REGEXP '\w'; -- Expected 1 row, actual 0 rows (WRONG): SELECT name FROM (SELECT * FROM t UNION ALL SELECT * FROM t WHERE 0) x WHERE name REGEXP '\w'; ```