Repository navigation
Description
Environment
- Branch:
main - Commit:
4b38c3fdf7287bc4fa69e34cf6d9ba1d88d308b3 - Deployment: local
mo-service, 2 CN / 1 TN / 1 Log service / Proxy - Tested endpoints: Proxy
6001, CN16001, CN16002 - Client: Go
database/sql+go-sql-driver/mysqlbinary prepared protocol - Date: 2026-08-09
Bug
A binary-protocol prepared query fails with internal error: not supported type ENUM or internal error: not supported type YEAR when an ENUM/YEAR secondary
index can cover the query. The equivalent literal, SQL PREPARE ... EXECUTE USING,
index-free scan, and base-table backfill query all succeed.
Reproduction
Set up the table:
create database enum_prepare_repro;
use enum_prepare_repro;
create table t(
id int primary key,
e enum('red','green','blue'),
payload varchar(20),
index idx_e(e)
);
insert into t values
(1,'red','one'),
(2,'green','two'),
(3,'blue','three'),
(4,null,'null');Execute through the binary prepared protocol:
db, _ := sql.Open("mysql", "user:password@tcp(127.0.0.1:6001)/enum_prepare_repro")
stmt, _ := db.Prepare("select id from t force index(idx_e) where e=?")
var id int
err := stmt.QueryRow("red").Scan(&id)
fmt.Println(id, err)Actual:
0 Error 20101 (HY000): internal error: not supported type ENUM
Expected:
1 <nil>
Passing controls
All of these return row 1:
select id from t force index(idx_e) where e='red';
set @v='red';
prepare s from 'select id from t force index(idx_e) where e=?';
execute s using @v;
select id from t ignore index(idx_e) where e='red';The binary protocol also succeeds when a non-indexed predicate forces base-table
backfill:
stmt, _ := db.Prepare(
"select id from t force index(idx_e) where e=? and payload='one'",
)
// returns id=1Coverage
Reproduced 3/3 through the Proxy and directly through both CNs.
Failing binary-protocol covering variants:
=,<=>,IN, and range predicates;- string,
[]byte, integer, and NULL binds; - single-column ENUM index;
- composite indexes with ENUM as the leading or second part.
The same matrix was repeated for an indexed YEAR column with integer, string, and
[]byte binds. All three endpoints failed 3/3 with not supported type YEAR, while
literal, index-free scan, and backfill controls returned the expected 2026 row.
Passing controls on every run:
- forced-index literal;
- server-side SQL
PREPARE ... EXECUTE USING @var; IGNORE INDEXbinary prepare;- natural scan binary prepare;
- forced-index query that requires base-table backfill.
Root-cause direction
The failure is isolated to the runtime covering/index-only path. The serial encoder
supports both types.T_enum and types.T_year, but serialExtract in
pkg/sql/plan/function/func_builtin.go has neither result case and returns the exact
observed unsupported-type internal errors. A runtime binary parameter keeps the typed
residual dynamic, so the covering rewrite needs to extract the typed value from the
serialized index key; the literal and backfill paths avoid that unsupported
extraction.
This is distinct from:
- [Bug]: VARBINARY index-only equality treats empty and NUL values as prefixes #26807/fix binary secondary-index point lookup semantics #26809: byte-string prefix equality semantics;
- [Bug]: Prefix-index covering queries drop values longer than the indexed prefix #26813: explicitly truncated VARCHAR prefix indexes;
- [Bug]: The operation "having count(*) > 1" is not supported when selecting ENUM type columns. #11788: an old ENUM
HAVINGaggregation failure; - [Bug]: enum type:Enum types column are not supported as primary key in pessimistic mode. #11352: ENUM primary keys in pessimistic mode.
Activity
[-][Bug]: binary prepared ENUM covering-index queries fail with not supported type ENUM[/-][+][Bug]: binary prepared ENUM/YEAR covering-index queries fail with unsupported type[/+]VioletQwQ-0 commentedon Aug 11, 2026
Post-merge testing handoff for #26873
Merged PR: #26943
QA Decision
Tester and expected result
The issue remains open with phase/testing until complete tester evidence is received.
slyunnn commentedon Aug 13, 2026
Regression and extended verification for #26873 (2026-08-13)
Validated the fix from PR #26943 for binary prepared ENUM and YEAR covering-index queries on current MatrixOne main.
Verification Environment
MatrixOne main: 76f62df — fix interval time windows (fix interval time windows #27000).
Related fix: PR fix: support enum and year in serial_extract #26943, merge commit 8c6ada2 — fix: support enum and year in
serial_extract (fix: support enum and year in serial_extract #26943).
MOTR branch: test/issue-26873-binary-prepared-enum-year.
MOTR commit: 7ddb34dfd00729fda72f4dd0990f9c41c55c349b — test: add MOTR regression for [Bug]: binary prepared ENUM/YEAR covering-index queries fail with unsupported type #26873.
Deployment: local mo-service Docker topology with 2 CN / 1 TN / 1 Log service / Proxy.
Tested endpoints: Proxy 6001, CN1 16001, and CN2 16002.
Client: Go database/sql with go-sql-driver/mysql, using interpolateParams=false to exercise binary
COM_STMT_PREPARE / COM_STMT_EXECUTE.
The local image was built from current main with ONNX Runtime download skipped because of an unavailable third-party
artifact download. ONNX-dependent functionality was not covered; this does not affect the SQL/index/protocol
behavior verified for this issue.
What Was Covered
OK — Original reproduction: binary prepared covering-index equality on indexed ENUM and YEAR returned expected rows
through Proxy 6001, CN1 16001, and CN2 16002; no ERROR 20101 unsupported-type error occurred.
OK — Happy path: indexed ENUM and YEAR predicates with string and []byte binds returned expected rows through binary
prepared statements on all three endpoints.
OK — Happy path: YEAR range predicates and composite secondary-index predicates returned expected ordered rows on
all three endpoints.
OK — Unhappy path: NULL binds returned empty result sets without unsupported-type errors on all three endpoints.
OK — Boundary scenario: an absent YEAR boundary value 1901 returned an empty result set without errors on all three
endpoints.
OK — Compatibility/control scenarios: literal queries, IGNORE INDEX, and forced-index queries requiring base-table
backfill returned expected rows on all three endpoints.
Findings
The original issue does not reproduce on current main in the complete local 2 CN / 1 TN / 1 Log service / Proxy
topology.
The current behavior satisfies the acceptance scope: binary prepared covering-index queries for ENUM and YEAR return
expected rows through Proxy and direct CN connections without internal error: not supported type ENUM or internal
error: not supported type YEAR.
Literal, index-free, and base-table-backfill controls remain consistent with binary prepared-statement results.
Integer binding and string range semantics for ENUM were explored during test design but are outside this issue’s
typed extraction fix and are not classified as issue regressions.
MOTR / BVT Coverage
Added suites/14_issue_regression/t/issue_26873_binary_prepared_enum_year.test.
Added suites/14_issue_regression/r/issue_26873_binary_prepared_enum_year.result.
Added script/14_issue_regression/issue_26873_binary_prepared_enum_year_protocol.go and its launcher to exercise real
binary prepared-statement packets.
MOTR recording passed: 22 statements.
MOTR replay passed: 22 statements.
Binary protocol scenario passed through Proxy 6001, CN1 16001, and CN2 16002.
The SQL case keeps stable SQL/literal controls; the scenario script is required because .test files cannot emit
MySQL binary prepared-statement packets.
Final Conclusion
Fixed. PR #26943 is verified on current main in the complete local multi-CN topology. The original reproduction and
expanded binary-protocol coverage passed through Proxy and both direct CN endpoints.