dolthub / dolthub/dolt

Dolt ignores default backslash escaping for wildcard characters in a window child

Open
#11,558 0 comments 0 reactions 0 assignees View on GitHub
bug correctness customer issue good repro sql
Dominant language
Go
Stars
24.4k
Forks
873
Avg merge
1d 8h
Merged PRs (30d)
120

Description

## What happened

Dolt treats the default backslash escape in LIKE as an ordinary character when the LIKE expression is evaluated below FIRST_VALUE, while an explicit ESCAPE clause still works.

## Environment

Dolt main commit c3b5ce3c67f8677ca08a0a58d8c03cdc95bff8b7, dolt version 2.3.0; MySQL 8.0.43 is the oracle.

## How to reproduce

Run this SQL in a fresh Dolt repository.

```sql
SELECT FIRST_VALUE('a_%' LIKE 'a\_\%') OVER () AS default_x1,
FIRST_VALUE('aX%' LIKE 'a\_\%') OVER () AS default_x2,
FIRST_VALUE('a_%' LIKE 'a!_!%' ESCAPE '!') OVER () AS explicit_x1,
FIRST_VALUE('aX%' LIKE 'a!_!%' ESCAPE '!') OVER () AS explicit_x2
FROM (SELECT 1 AS z) q;
```

## Expected result

MySQL 8.0.43 returns:

```text
default_x1 default_x2 explicit_x1 explicit_x2
1 0 1 0
```

## Actual result

Dolt returns:

```text
default_x1 default_x2 explicit_x1 explicit_x2
true true true false
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Run the reported SQL in a fresh Dolt repository and compare its default-escape results with MySQL 8.0.43, then trace how LIKE expressions are evaluated beneath FIRST_VALUE. Done means default backslash escaping produces 1 and 0 as expected while the existing explicit ESCAPE results remain correct, with a regression test for the query.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, mysql, sql
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.