Repository navigation
Description
Is there an existing issue for the same bug?
- I have checked the existing issues, including open and closed issues.
Branch Name
main
Commit ID
Other Environment Information
- MatrixOne: locally built from the commit above (
8.0.30-MatrixOne-v1.3.0) - MySQL baseline: 8.0.46
- Verification date: 2026-09-10
Actual Behavior
Non-unique secondary indexes cannot serialize a DECIMAL256 key (DECIMAL precision 39 through 76).
There are two externally visible failure modes:
CREATE INDEXon a populated Decimal256 column fails immediately withinternal error: not supported type DECIMAL256.- Declaring the same index in
CREATE TABLEsucceeds and the index appears inSHOW INDEX, but the firstINSERTfails with the same internal error and writes no row.
The behavior starts exactly at the Decimal128/Decimal256 boundary: DECIMAL(38,0) with the same ordinary index can be populated and queried, while DECIMAL(39,0) cannot. It also affects scaled Decimal256 keys, composite indexes containing a Decimal256 component, and an index on a Decimal256 generated column.
This is specific to ordinary secondary-index serialization. Decimal256 values work in heap-table writes, scans, predicates, grouping, ordering, prepared statements, stored generated columns, primary keys, and unique indexes. Duplicate enforcement by a Decimal256 unique index also works.
MySQL 8.0.46 accepts and populates the equivalent ordinary indexes for its supported Decimal precision range.
Expected Behavior
An ordinary secondary index should accept Decimal256 key components and remain writable after creation, just as primary and unique indexes do. At minimum, DDL must not succeed and leave a table whose ordinary inserts fail with an internal error.
MatrixOne's current DECIMAL documentation describes Decimal256 as the representation for precision 39 through 76, and the CREATE INDEX documentation does not exclude DECIMAL keys:
- https://docs.matrixorigin.cn/en/v26.3.0.12/MatrixOne/Reference/Data-Types/fixed-point-types/
- https://docs.matrixorigin.cn/en/v24.1.1.2/MatrixOne/Reference/SQL-Reference/Data-Definition-Language/create-index/
Steps to Reproduce
DROP DATABASE IF EXISTS decimal256_index;
CREATE DATABASE decimal256_index;
USE decimal256_index;
-- Populated-table DDL path.
CREATE TABLE base_t (
id INT PRIMARY KEY,
d DECIMAL(40,0),
s DECIMAL(50,10)
);
INSERT INTO base_t VALUES
(1,9999999999999999999999999999999999999999,
1234567890123456789012345678901234567890.1234567890),
(2,1,-0.0000000001),
(3,-1,0.0000000001);
CREATE INDEX idx_d ON base_t(d);
CREATE INDEX idx_s ON base_t(s);
CREATE INDEX idx_id_d ON base_t(id,d);
-- Empty-table DDL succeeds, but the write path fails.
CREATE TABLE inline_t (
id INT PRIMARY KEY,
d DECIMAL(40,0),
INDEX idx_d(d)
);
SHOW INDEX FROM inline_t;
INSERT INTO inline_t VALUES
(1,9999999999999999999999999999999999999999);
SELECT * FROM inline_t;
-- Boundary control: Decimal128 ordinary index works.
CREATE TABLE d38_t (
id INT PRIMARY KEY,
d DECIMAL(38,0),
INDEX idx_d(d)
);
INSERT INTO d38_t VALUES
(1,99999999999999999999999999999999999999);
SELECT * FROM d38_t
WHERE d=99999999999999999999999999999999999999;
-- The smallest Decimal256 precision already fails.
CREATE TABLE d39_t (
id INT PRIMARY KEY,
d DECIMAL(39,0),
INDEX idx_d(d)
);
INSERT INTO d39_t VALUES
(1,999999999999999999999999999999999999999);Additional information
The index-key path depends on serial / serial_full. Calling those functions directly with a Decimal256 column reproduces the same internal error. In pkg/sql/plan/function/func_builtin.go, the serialization type switches handle Decimal64 and Decimal128 but have no T_decimal256 case, even though the packer and other execution subsystems now support Decimal256.
The full matrix above, including DDL-time, write-time, scale, composite, generated-column, boundary, primary-key, unique-key, and duplicate controls, was reproduced three times on the same latest-main build.
Activity
fix: support decimal256 indexes and normalize spill errors (#28845)
Ariznawlll commentedon Sep 17, 2026
Verified on latest main
4c31142f4d0c46e9674b365826acc015b35ac2. The fixing changee4511d6af4(PR #28845, explicitly linked to #28586) is included.Revalidated ordinary secondary-index serialization for Decimal256 on a fresh local standalone cluster:
DECIMAL(40,0)/DECIMAL(50,10)table: ordinary indexes created successfully after data was present (idx_d,idx_s, and compositeidx_id_d). Forced-index reads returned all values in the expected decimal order.INDEX idx_d(d)onDECIMAL(40,0)accepted its first Decimal256 INSERT, and a forced-index read returned the exact 40-digit value.DECIMAL(38,0)and the first Decimal256 widthDECIMAL(39,0)accepted indexed inserts and equality lookup through the ordinary index.DECIMAL(50,10)ordinary and composite indexes accepted positive and negative scaled values; forced-index aggregation returned the exact expected sum.TestSerialEncodedTypeSizeBound,TestSerialEncodedTypeSizeBoundCoversRuntimeValue, andTestSerialDecimal256Encoding.No
not supported type DECIMAL256error occurred on the populated-table DDL path or on the post-DDL write path. Closing as fixed.fix: support decimal256 indexes and normalize spill errors (matrixori…
fix: support decimal256 indexes and normalize spill errors (matrixori…