[Bug]: CHAR/BINARY column wider than 255 returns 1690 'typeLen is over the MaxCharLen' instead of ER_TOO_BIG_FIELDLENGTH 1074

Open
#33,361 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
70/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
go, sql

Research direction

Start by reading the shared getTypeFromAst path and the existing handling for over-long VARCHAR columns, then trace how column names are available for CREATE TABLE and ALTER TABLE definitions. Check the relevant SQL tests for those statements. Done means overlong CHAR and BINARY columns return error 1074 with the offending column name, while length 255 and the separate CAST path remain unaffected.

Written by the indexing model from the issue text.

Description

kind/bug
Is there an existing issue for the same bug?
  • I have checked the existing issues (searched 1074, Column length too big, MaxCharLen, char(256)). #31809 and #30156 are about VARCHAR, not CHAR/BINARY.
Branch Name

main (9bf005bf)

Describe the bug

A CHAR(N) or BINARY(N) column with N > 255 is rejected with MO-internal error 1690 and the message data out of range: data type char, typeLen is over the MaxCharLen: 255. The message does not say which column is wrong. MySQL returns ER_TOO_BIG_FIELDLENGTH (1074, SQLSTATE 42000) and names the column. MO already does this for an over-long VARCHAR column.

The check is in the shared getTypeFromAst, which has no column name, so it falls back to a generic OutOfRange error. The same happens for ALTER TABLE ... ADD/MODIFY/CHANGE COLUMN.

Steps to reproduce
CREATE TABLE t1 (id INT PRIMARY KEY, code CHAR(256));
CREATE TABLE t2 (id INT PRIMARY KEY, digest BINARY(300));
CREATE TABLE t3 (id INT PRIMARY KEY, code CHAR(255));
ALTER TABLE t3 ADD COLUMN note CHAR(256);
Expected behavior (MySQL 8.4)
ERROR 1074 (42000): Column length too big for column 'code' (max = 255); use BLOB or TEXT instead
ERROR 1074 (42000): Column length too big for column 'digest' (max = 255); use BLOB or TEXT instead
ERROR 1074 (42000): Column length too big for column 'note' (max = 255); use BLOB or TEXT instead
Actual behavior (MatrixOne main 9bf005bf)
ERROR 1690: data out of range: data type char,  typeLen is over the MaxCharLen: 255
ERROR 1690: data out of range: data type binary,  typeLen is over the MaxCharLen: 255
ERROR 1690: data out of range: data type char,  typeLen is over the MaxCharLen: 255
Additional information

Single-node mo-service -launch etc/launch/launch.toml. CAST(x AS CHAR(N)) is a separate path and is not part of this issue.

本操作由 LW 授权的 Grok Bot 智能体执行。

Dominant language
Go
Stars
1.9k
Forks
312
Avg merge
22h 59m
Merged PRs (30d)
736

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from matrixorigin/matrixone

All issues in matrixorigin/matrixone

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.