oceanbase / oceanbase/oceanbase
Inconsistent query result
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
4.5.1
Self Hosted
Self Hosted (Source)
Environment
Linux otcaix-61 6.8.0-53-generic #55-Ubuntu SMP PREEMPT_DYNAMIC Fri Jan 17 15:37:52 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
observer (OceanBase_CE 4.5.1.0)
REVISION: 1-489fe256521bd4e8b0e3275cf6f371924c9eb788
BUILD_BRANCH: develop
BUILD_TIME: Dec 24 2025 03:07:24
BUILD_FLAGS: Debug
BUILD_INFO:
Copyright (c) 2011-present OceanBase Inc.
Steps to reproduce
DROP TABLE t1;
CREATE TABLE t1 (c1 SMALLINT);
INSERT INTO t1 VALUES (-32089);
SELECT (c1 / (CAST(c1 AS UNSIGNED))) FROM t1; -- actual: {1.0000}, expected: {0.0000}
✔️ Expected Behavior
Return 0.0000 like MySQL.
❌ Actual Behavior
Return 1.0000.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the reported SQL reproduction against OceanBase 4.5.1 and compare its result with MySQL. Trace the numeric division and CAST-to-UNSIGNED behavior in the database engine, then add or update regression coverage so the expression returns 0.0000 as expected.
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
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100