Please allow generated columns to be based on new columns in the same SQL statement
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Feature Request
**Is your feature request related to a problem? Please describe:**
The following SQLs have no error in mysql, but report error in tidb
```sql
drop table if exists tb;
create table tb (id int primary key);
alter table tb add column a json null,
add column b varchar(255) generated always as (a->"$.b");
```
Error:
```sql
ERROR 1054 (42S22): Unknown column 'a' in 'generated column function'
```
**Describe the feature you'd like:**
Please allow generated columns to be based on new columns in the same SQL statement
**Describe alternatives you've considered:**
A paid customer has no alternative, because these SQLs are generated by 3rd application that runs on mysql
**Teachability, Documentation, Adoption, Migration Strategy:**
There is no such limitation documented in [Generated Columns](https://docs.pingcap.com/tidb/stable/generated-columns#limitations)
Contributor guide
Assessment
This issue has not been assessed yet.