DELETE statement execution results are inconsistent within and outside a transaction
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Bug Report
Please answer these questions before submitting your issue. Thanks!
### 1. Minimal reproduce step (Required)
```sql
/* init */ CREATE TABLE t(c0 TEXT(284));
/* tx */ BEGIN;
/* tx */ REPLACE INTO t VALUES ('G6y*k]88]');
/* tx */ DELETE FROM t WHERE CAST(TIDB_VERSION() AS DATE); -- report an error
/* tx */ COMMIT;
```
### 2. What did you expect to see? (Required)
DELETE statement only reports a warning:
```sql
tidb> REPLACE INTO t VALUES ('G6y*k]88]');
Query OK, 1 row affected (0.01 sec)
tidb> DELETE FROM t WHERE CAST(TIDB_VERSION() AS DATE);
Query OK, 0 rows affected, 1 warning (0.00 sec)
Warning[1292] evaluation failed: Incorrect datetime value: 'Release Version: v6.4.0
Edition: Community
Git Commit Hash: cf36a9ce2fe1039db3cf3444d51930b887df18a1
Git Branch: heads/refs/tags/v6.4.0
UTC Build Time: 2022-11-13 05:25:30
GoVersion: go1.19.2
Race Enabled: false
TiKV Min Version: 6.2.0-alpha
Check Table Before Drop: false
Store: tikv'
```
### 3. What did you see instead (Required)
DELETE statement in tx reports an error:
```sql
/* tx */ DELETE FROM t WHERE CAST(TIDB_VERSION() AS DATE);
ERROR 1292 (22007): Incorrect datetime value: 'Release Version: v6.4.0
Edition: Community
Git Commit Hash: cf36a9ce2fe1039db3cf3444d51930b887df18a1
Git Branch: heads/refs/tags'
```
### 4. What is your TiDB version? (Required)
```sql
Release Version: v6.4.0
Edition: Community
Git Commit Hash: cf36a9ce2fe1039db3cf3444d51930b887df18a1
Git Branch: heads/refs/tags/v6.4.0
UTC Build Time: 2022-11-13 05:25:30
GoVersion: go1.19.2
Race Enabled: false
TiKV Min Version: 6.2.0-alpha
Check Table Before Drop: false
Store: tikv
```
Contributor guide
Assessment
This issue has not been assessed yet.