Skip to content

TINYTEXT accepts values larger than the MySQL-compatible 255-byte limit #26687

Closed

Description

@iamlinjunhong

MatrixOne version

  • Server: 8.0.30-MatrixOne-v25908
  • Commit: 35252ddec751e82f5a7209c6e242ed247626f3d6
  • Compatibility test: MySQL Connector/ODBC 9.7.0 upstream t_text_fetch

Reproduction

set @@sql_mode='';
drop table if exists tinytext_limit_repro;
create table tinytext_limit_repro (value tinytext);
insert into tinytext_limit_repro values (repeat('A', 1000));
select length(value) from tinytext_limit_repro;

Observed result: 1000.

The same behavior is visible through ODBC prepared parameter binding: a 1000-byte value is stored and SQLGetData returns indicator length 1000. The upstream Connector/ODBC test expects the MySQL TINYTEXT maximum of 255 bytes when non-strict sql_mode permits truncation.

Expected behavior

TINYTEXT should retain MySQL-compatible size semantics: at most 255 bytes, with the configured strict/non-strict SQL mode determining error versus truncation/warning behavior. It should not behave as an unbounded alias of TEXT.

Impact

Applications that select TINYTEXT to enforce a MySQL-compatible schema constraint can persist data that MySQL rejects or truncates. ODBC length indicators, migrations, validation logic, and cross-database round trips then disagree even though the DDL is accepted by both systems.

This is independent of #26683, which concerns COM_QUERY declared-length metadata. Here the stored value itself exceeds the declared MySQL type limit.

Activity

  1. added
    ai-easy
    on Aug 7, 2026
  2. Repository owner unassigned on Aug 10, 2026
  3. ghost assigned on Aug 10, 2026
  4. slyunnn commented on Aug 11, 2026

    @slyunnn

    Regression and extended verification for #26687 (2026-08-11)

    Verification environment

    • MatrixOne main: d01c85974f9540f8baa2e768ca86fea952941fe2
      • fix(hashjoin): broadcast const vectors in spill paths (#26938)
    • Fix commit: ae2af58bf4b4feaeb65ddb85a59a1e10fb80bc53
      • fix: enforce TINYTEXT byte length limit (#26697)
    • MOTR branch: test/issue-26687-tinytext-byte-limit
    • MOTR commit: 3fab7cbab350436c651e50f3fa5250e14fa44734
    • Topology: local single-node MatrixOne service.

    Regression verification

    Reproduced the original non-strict-mode case:

    • A 1000-byte ASCII value written to TINYTEXT is stored as 255 bytes.
    • TINYTEXT no longer behaves as an unbounded TEXT alias.

    Result: passed.

    Extended verification

    • ASCII boundary:

      • 255-byte value is retained.
      • 256-byte value is truncated to 255 bytes in non-strict mode.
    • UTF-8 byte boundary:

      • 85 Chinese characters occupy 255 bytes and are retained.
      • 86 Chinese characters occupy 258 bytes and are truncated safely to 85 characters / 255 bytes.
      • No multi-byte UTF-8 character is split.
    • Strict SQL mode:

      • A 256-byte value is rejected with error 1406.
      • The rejected write does not add a row.

    MOTR regression

    • Added:
      • suites/14_issue_regression/t/issue_26687_tinytext_byte_limit.test
      • suites/14_issue_regression/r/issue_26687_tinytext_byte_limit.result
    • Record: 13/13 statements passed.
    • Replay: 13/13 statements passed.

    Test-file changes

    The MOTR files were added to preserve the 255-byte TINYTEXT boundary across strict and non-strict SQL modes, and to
    prevent UTF-8 truncation from splitting a multi-byte character. No MatrixOne service source code was modified.

    Final conclusion

    #26687 is fixed on current main: TINYTEXT enforces the MySQL-compatible 255-byte limit, truncates safely in non-
    strict mode, and rejects oversized values in strict mode.

    Suggested resolution: merge the MOTR regression PR and close #26687.

  5. assigned and unassigned on Aug 11, 2026
  6. assigned and unassigned on Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

ai-easyarea/compatibilitykind/bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions