oceanbase / oceanbase/oceanbase
FLOAT ZEROFILL column renders negative zero as `0000000000-0` (sign character at wrong position)
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-v4.5.0.0
Self Hosted
Self Hosted (OBD)
Environment
| Field | Value |
|---|---|
| OS | Ubuntu 20.04.4 LTS |
| CPU Architecture | x86 — Intel(R) Xeon(R) Platinum 8358P @ 2.60GHz (64 Cores) |
| Client | obclient |
obclient(root@sys)[oceanbase]> select version();
+------------------------------+
| version() |
+------------------------------+
| 5.7.25-OceanBase_CE-v4.5.0.0 |
+------------------------------+
1 row in set (0.002 sec)
obclient(root@sys)[oceanbase]> SHOW VARIABLES LIKE 'version_comment';
+-----------------+------------------------------------------------------------------------------------------------------------------+
| Variable_name | Value |
+-----------------+------------------------------------------------------------------------------------------------------------------+
| version_comment | OceanBase_CE 4.5.0.0 (r100000012025112711-0e8d5ad012baf0953b2032a35a88bdf8886e9a7a) (Built Nov 27 2025 12:06:16) |
+-----------------+------------------------------------------------------------------------------------------------------------------+
1 row in set (0.015 sec)
---
Steps to reproduce
-- Step 1: Create a FLOAT ZEROFILL table
DROP TABLE IF EXISTS ob_bug_float_zerofill_mre;
CREATE TABLE ob_bug_float_zerofill_mre (c0 FLOAT ZEROFILL NULL);
-- Step 2: Insert a negative-zero value via string coercion
-- ('-0' is a valid MySQL input; no error or warning is raised on either MySQL or OceanBase)
INSERT INTO ob_bug_float_zerofill_mre (c0) VALUES ('-0');
-- Step 3: Query the stored value with HEX diagnostic
SELECT
c0,
HEX(CAST(c0 AS CHAR)) AS c0_hex
FROM ob_bug_float_zerofill_mre;
✔️ Expected Behavior
The value should be displayed as a valid zero-padded string.
Acceptable outputs are either:
000000000000— the negative zero is normalised to positive zero before formatting, or-00000000000— the sign character is placed at the beginning of the padded string.
❌ Actual Behavior
OceanBase renders the value as 0000000000-0, with the sign character - placed
at position 10 (the end of the string) instead of position 0 (the beginning).
No error or warning is raised.
+--------------+--------------------------+
| c0 | c0_hex |
+--------------+--------------------------+
| 0000000000-0 | 303030303030303030302D30 |
+--------------+--------------------------+
1 row in set (0.007 sec)
HEX breakdown:
Byte position: 0 1 2 3 4 5 6 7 8 9 10
Hex value: 30 30 30 30 30 30 30 30 30 2D 30
Decoded: 0 0 0 0 0 0 0 0 0 - 0
^
0x2D ('-') is here — should be at position 0
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 provided SQL reproduction for FLOAT ZEROFILL and inspect the formatting entry point that produces the displayed value. Trace how the negative-zero sign and zero padding are ordered, then verify that the output is normalized or has its sign at the beginning without errors or warnings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100