pingcap / pingcap/tidb

Fail to execute statements in TiDB but success in MySQL

Open
#57,439 1 comment 0 reactions 0 assignees View on GitHub
compatibility-mysql80 component/ddl type/bug type/compatibility
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
create table `t1` (`a` int default 1,`b` int generated always as(-`a`) virtual,`c` int generated always as(-`a`) stored) partition by hash(b) partitions 64;
insert into `t1` values (10,default,default),(20,default,default);
update `t1` set `b`=default;
update `t1` set `a`=30, `b`=default where `a`=10;
update `t1` set `b`=default(`a`);
```

### 2. What did you expect to see? (Required)

Statements executed succussfully.

### 3. What did you see instead (Required)
```sql
mysql> update `t1` set `a`=30, `b`=default where `a`=10;
ERROR 8141 (HY000): assertion failed: key: 7480000000000006505f728000000000000003, assertion: Exist, start_ts: 454001608752103434, existing start ts: 0, existing commit ts: 0
mysql>
mysql> update `t1` set `b`=default(`a`);
ERROR 3105 (HY000): The value specified for generated column 'b' in table 't1' is not allowed.
```

### 4. What is your TiDB version? (Required)
```sql
Release Version: v8.5.0-alpha-79-g426ce3e570
Edition: Community
Git Commit Hash: 426ce3e57069afbd8f061d7ae39c79d3f9e2ff5d
Git Branch: master
UTC Build Time: 2024-11-09 12:25:03
GoVersion: go1.23.0
Race Enabled: false
Check Table Before Drop: false
Store: tikv
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.