TiDB should not allow to analyze different partitions of a table with different analyze versions
- 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)
1. Create a partitioned table:
```sql
CREATE TABLE employees (
id INT NOT NULL,
fname VARCHAR(30),
lname VARCHAR(30),
hired DATE NOT NULL DEFAULT '1970-01-01',
separated DATE DEFAULT '9999-12-31',
job_code INT,
store_id INT NOT NULL
) PARTITION BY RANGE (id) (
PARTITION p0 VALUES LESS THAN (1000),
PARTITION p1 VALUES LESS THAN (2000),
PARTITION p2 VALUES LESS THAN (3000),
PARTITION p3 VALUES LESS THAN MAXVALUE
);
INSERT INTO employees (id, fname, lname, hired, store_id)
VALUES (100, 'John', 'Doe', '2024-02-19', 1);
INSERT INTO employees (id, fname, lname, hired, store_id)
VALUES (2000, 'Alice', 'Smith', '2024-02-19', 2);
```
2. Analyze them in different sessions:
```sql
set @@session.tidb_analyze_version=2;
analyze table employees partition p0;
```
3. Another session:
```sql
set @@session.tidb_analyze_version=1;
analyze table employees partition p2;
```
### 2. What did you expect to see? (Required)
An error to tell users this won't work.
### 3. What did you see instead (Required)
Analyzed the table with different versions:


### 4. What is your TiDB version? (Required)
master
Contributor guide
Assessment
This issue has not been assessed yet.