You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: DECIMAL256 division wrongly applies a DECIMAL128 result limit to valid quotients #28774
ERROR 1690 (22003): data out of range: data type DECIMAL,
invalid input: Decimal128 Div overflow:
1.000000000000000000000000000000/0.000000000000000003
CREATETABLEt(
id INTPRIMARY KEY,
a DECIMAL(65,30), b DECIMAL(65,18),
result_value DECIMAL(65,30), note VARCHAR(20)
);
INSERT INTO t VALUES
(1,1,0.000000000000000003,NULL,'original'),
(2,0.000000000000000006,0.000000000000000003,NULL,'original');
UPDATE t SET result_value=a/b,note='changed';
SELECT id,result_value,note FROM t ORDER BY id;
Regression and extended verification for #28774 (2026-09-16)
Verification Environment
Source and runtime: latest origin/main at 66b1672403e9b9efb1971d00b7ea87572891fe2a (fix: release opaque aggregate spill state on reuse (#28925)); the running binary reported Git commit 66b1672403.
Topology: local 1 Log service / 1 TN / 2 CN / Proxy. All validation used the MySQL wire protocol.
Endpoints: Proxy 127.0.0.1:6001, CN1 127.0.0.1:16001, and CN2 127.0.0.1:16002; all three were reachable. Original SQL ran through all three endpoints; Prepared Statement and JDBC BVT execution ran through Proxy.
Compatibility control: temporary local MySQL 8.3.0, also through the MySQL wire protocol, was used for the original wide quotient and signed-minimum-divisor boundary, then removed.
Related fix: 8130d012ebf5cb0b7d8a94699d981570e9420849, [Bug]: preserve DECIMAL division range and rounding (#28814); it fixes this issue and is an ancestor of the tested main commit.
What Was Covered
OK Original reproduction on Proxy, CN1, and CN2: CAST('1' AS DECIMAL(65,30)) / CAST('0.000000000000000003' AS DECIMAL(65,18)) returned 333333333333333333.333333333333333333333333333333 without Decimal128 Div overflow.
OK Happy path: a two-row UPDATE stored the wide quotient for id=1 and 2.000000000000000000000000000000 for id=2.
OK Prepared Statement reuse: a Prepared UPDATE first rejected a zero divisor with 1365 / 22012; the same statement then successfully updated id=2 and id=1 with the expected values.
OK Atomicity/unhappy path: a three-row UPDATE containing one zero divisor failed with 1365 / 22012, and all rows retained NULL / original; no partial update was committed.
OK Boundary scenario: the signed Decimal128 minimum divisor path produced -0.000001 for the positive numerator, matching the corrected Decimal256 fallback contract.
OK Narrow-scale control: the DECIMAL(65,0) numerator path remained successful, proving the repaired DECIMAL(65,30) result no longer inherits the incorrect Decimal128 result limit.
OK Focused unit coverage: TestD256DivViaD128PreservesWideQuotient, TestD256DivViaD128MinInt128Divisor, and TestD128DivLargeDivisorHalfUp passed through the repository CGo wrapper.
OK Existing BVT: test/distributed/cases/dtype/decimal_256.test replayed twice through JDBC in normal comparison mode; both runs passed 16/16 with 0 failed/ignored/abnormal cases.
OK MySQL 8.3.0 comparison: the original wide quotient and signed-minimum-divisor boundary matched exactly.
Not covered MySQL div_precision_increment policy: the DECIMAL(65,0) control shows MySQL's default 4 fractional digits and MatrixOne's current 6; this is the separate existing compatibility scope of #28594, not the valid-wide-quotient overflow defect.
Not covered restart, mixed-version rollout, or large-scale execution: none is part of this scalar Decimal division contract.
Findings
The D128 fast path now preserves a valid DECIMAL256 quotient instead of requiring the final scaled result to fit back into Decimal128. It also correctly falls back for the signed Decimal128 minimum operand and preserves rounding behavior. The original legal 48-digit result now reaches SQL, DML, Prepared Statement, Proxy, CN1, and CN2 consumers correctly.
MOTR / BVT Coverage
No new MOTR case, branch, or commit is needed. The merged fix already added the canonical self-contained distributed BVT test/distributed/cases/dtype/decimal_256.test, covering #28774's original wide quotient, the signed-minimum-divisor boundary, and related Decimal division controls; its recorded result replayed twice successfully. Test execution was serial because it used a shared local topology; this issue has no engine-parallel execution contract.
Large-data regression is not required. The defect is a scalar type-domain and scale-conversion decision; it does not depend on row count, block/batch boundaries, memory/spill, concurrency, skew, network-transfer volume, index state, or resource scale. Minimum rows cover the DML atomicity and Prepared Statement boundaries without unrelated CI cost.
Final Conclusion
Fixed. The merged fix is present in the tested latest main; original reproduction, multi-CN execution, DML atomicity, Prepared Statement reuse, signed-minimum boundary, focused unit tests, repeated JDBC BVT, and the relevant MySQL 8.3.0 compatibility comparison all passed.
Activity
[Bug]: preserve DECIMAL division range and rounding (#28814)
slyunnn commentedon Sep 16, 2026
Regression and extended verification for #28774 (2026-09-16)
Verification Environment
origin/mainat66b1672403e9b9efb1971d00b7ea87572891fe2a(fix: release opaque aggregate spill state on reuse (#28925)); the running binary reported Git commit66b1672403.1 Log service / 1 TN / 2 CN / Proxy. All validation used the MySQL wire protocol.127.0.0.1:6001, CN1127.0.0.1:16001, and CN2127.0.0.1:16002; all three were reachable. Original SQL ran through all three endpoints; Prepared Statement and JDBC BVT execution ran through Proxy.8.3.0, also through the MySQL wire protocol, was used for the original wide quotient and signed-minimum-divisor boundary, then removed.8130d012ebf5cb0b7d8a94699d981570e9420849,[Bug]: preserve DECIMAL division range and rounding(#28814); it fixes this issue and is an ancestor of the testedmaincommit.What Was Covered
CAST('1' AS DECIMAL(65,30)) / CAST('0.000000000000000003' AS DECIMAL(65,18))returned333333333333333333.333333333333333333333333333333withoutDecimal128 Div overflow.UPDATEstored the wide quotient forid=1and2.000000000000000000000000000000forid=2.UPDATEfirst rejected a zero divisor with1365/22012; the same statement then successfully updatedid=2andid=1with the expected values.UPDATEcontaining one zero divisor failed with1365/22012, and all rows retainedNULL/original; no partial update was committed.Decimal128minimum divisor path produced-0.000001for the positive numerator, matching the corrected Decimal256 fallback contract.DECIMAL(65,0)numerator path remained successful, proving the repairedDECIMAL(65,30)result no longer inherits the incorrectDecimal128result limit.TestD256DivViaD128PreservesWideQuotient,TestD256DivViaD128MinInt128Divisor, andTestD128DivLargeDivisorHalfUppassed through the repository CGo wrapper.test/distributed/cases/dtype/decimal_256.testreplayed twice through JDBC in normal comparison mode; both runs passed16/16with0failed/ignored/abnormal cases.8.3.0comparison: the original wide quotient and signed-minimum-divisor boundary matched exactly.div_precision_incrementpolicy: theDECIMAL(65,0)control shows MySQL's default4fractional digits and MatrixOne's current6; this is the separate existing compatibility scope of #28594, not the valid-wide-quotient overflow defect.Findings
The D128 fast path now preserves a valid
DECIMAL256quotient instead of requiring the final scaled result to fit back intoDecimal128. It also correctly falls back for the signedDecimal128minimum operand and preserves rounding behavior. The original legal48-digit result now reaches SQL, DML, Prepared Statement, Proxy, CN1, and CN2 consumers correctly.MOTR / BVT Coverage
No new MOTR case, branch, or commit is needed. The merged fix already added the canonical self-contained distributed BVT
test/distributed/cases/dtype/decimal_256.test, covering #28774's original wide quotient, the signed-minimum-divisor boundary, and related Decimal division controls; its recorded result replayed twice successfully. Test execution was serial because it used a shared local topology; this issue has no engine-parallel execution contract.Large-data regression is not required. The defect is a scalar type-domain and scale-conversion decision; it does not depend on row count, block/batch boundaries, memory/spill, concurrency, skew, network-transfer volume, index state, or resource scale. Minimum rows cover the DML atomicity and Prepared Statement boundaries without unrelated CI cost.
Final Conclusion
Fixed. The merged fix is present in the tested latest
main; original reproduction, multi-CN execution, DML atomicity, Prepared Statement reuse, signed-minimum boundary, focused unit tests, repeated JDBC BVT, and the relevant MySQL8.3.0compatibility comparison all passed.[Bug]: preserve DECIMAL division range and rounding (matrixorigin#28814)
[Bug]: preserve DECIMAL division range and rounding (matrixorigin#28814)
[Bug]: preserve DECIMAL division range and rounding (matrixorigin#28814)