Skip to content

COM_QUERY reports invalid declared lengths for VARCHAR and VARBINARY result metadata #26683

Closed

Description

@iamlinjunhong

MatrixOne version

  • Server: 8.0.30-MatrixOne-v25908
  • Commit: 35252ddec751e82f5a7209c6e242ed247626f3d6
  • Client: MySQL client 9.7.1 and MatrixOne ODBC based on Connector/ODBC 9.7.0

Reproduction

create database if not exists mo_odbc_deep;
create table mo_odbc_deep.t (
  id int primary key,
  c_varchar varchar(128),
  c_varbinary varbinary(128)
);
insert into mo_odbc_deep.t values (1, 'MatrixOne', x'010203');
select id, c_varchar, c_varbinary from mo_odbc_deep.t;

Inspect the COM_QUERY field packets with a MySQL client:

mysql --column-type-info -vvv -h 127.0.0.1 -P 6001 -u root \
  -e "select id,c_varchar,c_varbinary from mo_odbc_deep.t"

Observed metadata:

c_varchar:   Type VAR_STRING, Collation utf8mb3_general_ci (33), Length 4294967295
c_varbinary: Type VARCHAR,    Collation binary (63),              Length 384

The declared sizes are both 128. The same values propagate through MySQL Connector/ODBC: SQLDescribeCol reports ColumnSize=4294967295 for VARCHAR(128) and ColumnSize=384 for VARBINARY(128).

Expected behavior

The result-set column definition packets should expose declared lengths compatible with MySQL protocol semantics so ODBC clients infer:

  • VARCHAR(128) as 128 characters
  • VARBINARY(128) as 128 bytes

Impact

Power BI and other ODBC consumers use SQLDescribeCol / descriptor metadata to choose model types and buffers. The unlimited-looking VARCHAR size and tripled VARBINARY size can cause incorrect schema inference, unnecessary large-object treatment, and inconsistent behavior between catalog metadata and query-result metadata.

This is distinct from information_schema.columns.DATA_TYPE casing in #26680: that issue affects SQLColumns; this issue is visible directly in COM_QUERY result metadata and affects SQLDescribeCol.

ODBC regression coverage

A MatrixOne-specific public-API test now asserts the exact descriptor sizes for numeric, temporal, character, and binary columns. Until the server metadata is corrected, this case will be tracked as an expected MatrixOne failure rather than hidden by a generic driver cap.

Activity

  1. self-assigned this
    on Aug 4, 2026
  2. added
    ai-easy
    on Aug 5, 2026
  3. iamlinjunhong commented on Aug 7, 2026

    @iamlinjunhong
    ContributorAuthor

    Verified fixed on current main d0057b3 by c31b46d (PR #26710). The public ODBC SQLDescribeCol regression now passes with exact sizes VARCHAR(128)=128 and VARBINARY(128)=128 for both Unicode and ANSI drivers. Closing as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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