pingcap / pingcap/tidb

Unstable result while executing query

Open
#65,653 3 comments 0 reactions 0 assignees View on GitHub
contribution may-affects-7.1 may-affects-7.5 may-affects-8.1 may-affects-8.5 severity/major sig/planner type/bug
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 t0(c0 CHAR , c1 BLOB(173) , c2 CHAR );

UPDATE t0 SET c0='K', c2=-493926160;
ALTER TABLE t0 DROP c1;
CREATE ALGORITHM=UNDEFINED VIEW v0(c0) AS SELECT t0.c2 FROM t0 WHERE t0.c0;
REPLACE INTO t0 VALUES (NULL, '0'), ('0', 'X'), ('A', '0');
ADMIN CHECKSUM TABLE t0;
INSERT INTO t0(c0) VALUES ('6');

ALTER TABLE t0 ADD PRIMARY KEY(c2);
REPLACE INTO t0 VALUES ('g', '1');

INSERT IGNORE INTO t0 VALUES ('_', '(');
REPLACE INTO t0(c2) VALUES ('p');
UPDATE t0 SET c2=t0.c2, c0=((818354575)AND(-498102208)) WHERE 0.31994056953914873;
REPLACE INTO t0(c0, c2) VALUES ('A', '8');
ALTER TABLE t0 DISABLE KEYS;
REPLACE INTO t0(c0) VALUES ('-'), ('遞');
REPLACE INTO t0(c2, c0) VALUES (NULL, '-');

SELECT t0.c0 FROM t0 NATURAL RIGHT JOIN v0 GROUP BY ((v0.c0) IS NOT NULL) HAVING '0' UNION ALL SELECT t0.c0 FROM t0 NATURAL RIGHT JOIN v0 GROUP BY ((v0.c0) IS NOT NULL) HAVING (NOT ('0')) UNION ALL SELECT t0.c0 FROM t0 NATURAL RIGHT JOIN v0 GROUP BY ((v0.c0) IS NOT NULL) HAVING (('0') IS NULL);

```

### 2. What did you expect to see? (Required)
Executing last query will always return same result

### 3. What did you see instead (Required)
Executing last query multiple times will return different results

### 4. What is your TiDB version? (Required)
8.0.11-TiDB-v9.0.0-beta.1.pre-640-g24903d6b24

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.