oceanbase / oceanbase/oceanbase

ANY Subquery Inconsistent Results

Open
#2,380 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
10.3k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

Self Checks
  • I have read the Contributing Guide.
  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.
OceanBase version

5.7.25 OceanBase_CE 4.3.5.5

Self Hosted

Self Hosted (Docker)

Environment

OS Version: Anolis OS 8.8
CPU Arch: aarch64
Platform: Docker Container
OceanBase Version: CE v4.3.5.5
Host OS: macOS 14.6.0 (Darwin Kernel 24.6.0) arm64

Steps to reproduce

CREATE TABLE t11 (c1 DOUBLE);
CREATE TABLE t12 (c1 INT);
INSERT INTO t11 (c1) VALUES (1.0), (2.0), (3.0);

SELECT -9 >= ANY(SELECT c1 AS ca11 FROM t11 WHERE (EXISTS (SELECT c1 FROM t12) - 1)IS NOT TRUE) as result;
+--------+
| result |
+--------+
| 0 |
+--------+
1 row in set (0.006 sec)

SELECT -9 >= ANY(SELECT c1 AS ca11 FROM t11 WHERE FALSE) AS result;
+--------+
| result |
+--------+
| 0 |
+--------+
1 row in set (0.004 sec)

CREATE UNIQUE INDEX idx_t11_c1 ON t11(c1);
SELECT -9 >= ANY(SELECT c1 AS ca11 FROM t11 WHERE (EXISTS (SELECT c1 FROM t12) - 1)IS NOT TRUE) AS result;
+--------+
| result |
+--------+
| NULL |
+--------+
1 row in set (0.014 sec)

SELECT -9 >= ANY(SELECT c1 AS ca11 FROM t11 WHERE FALSE) AS result;
+--------+
| result |
+--------+
| 0 |
+--------+
1 row in set (0.004 sec)

✔️ Expected Behavior

They should return the same result.

❌ Actual Behavior

They return different results.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the SQL reproduction against OceanBase CE 4.3.5.5, comparing the ANY subquery results before and after creating the unique index. Investigate the query execution behavior for the indexed and non-indexed cases; done means both equivalent queries return the same result.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, sql
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.