Skip to content

[Bug]: information_schema.columns exposes __mo_cpkey_col for composite primary keys, leaking through ODBC SQLColumns #26993

Closed

Description

@iamlinjunhong

Environment

  • MatrixOne: main at 9a7c98b8f3aa07fad24b411d54c7a9f6cb3a8731
  • Protocol version: 8.0.30-MatrixOne-v
  • Local standalone build, WSL2 Ubuntu 24.04
  • Client controls: MySQL 9.7.1 CLI and MatrixOne ODBC 9.7.0-mo.1 x64

Reproduction

DROP DATABASE IF EXISTS mo_odbc_hidden;
CREATE DATABASE mo_odbc_hidden;
CREATE TABLE mo_odbc_hidden.t (
  a INT NOT NULL,
  b INT NOT NULL,
  v VARCHAR(10),
  PRIMARY KEY (a, b)
);

SELECT ordinal_position, column_name, data_type, column_key, extra
FROM information_schema.columns
WHERE table_schema = 'mo_odbc_hidden' AND table_name = 't'
ORDER BY ordinal_position;

SHOW COLUMNS FROM mo_odbc_hidden.t;

Actual result

information_schema.columns returns an extra fourth column:

1  a               int      
2  b               int      
3  v               varchar
4  __mo_cpkey_col  varchar  PRI

SHOW COLUMNS, SELECT *, and the user's DDL expose only a, b, and v.

The same behavior is visible through the public ODBC catalog API because
Connector/ODBC implements SQLColumns from information_schema.columns:

  • TPC-H SF1 lineitem has 16 user columns;
  • MatrixOne ODBC SQLColumns returns 17 columns, including
    __mo_cpkey_col;
  • TPC-H partsupp is affected for the same composite-primary-key reason.

Expected result

User-facing metadata views and protocol catalog APIs must not expose internal
storage columns. information_schema.columns and ODBC SQLColumns should
return only the columns visible through SHOW COLUMNS and SELECT *.

Impact

This breaks generic schema discovery for BI/ETL tools. Power Query
Odbc.DataSource and Power BI Navigator consume ODBC catalog metadata, so an
internal MatrixOne column can appear in navigation/model metadata for every
table with a composite primary key. It also makes catalog metadata disagree
with result-set metadata and the actual selectable table shape.

The issue was found by the MatrixOne ODBC TPC-H SF1 public-data validation:
8 tables, 8,661,255 total rows, including 6,001,215 lineitem rows.

Activity

  1. iamlinjunhong commented on Aug 12, 2026

    @iamlinjunhong
    ContributorAuthor

    补充 Power Query / Power BI 实测:问题不只影响复合主键表。

    对没有显式主键的表执行同样的 information_schema.columns / ODBC SQLColumns 枚举时,还会泄露 __mo_fake_pk_col。Microsoft 官方 Power Query SDK 测试框架通过 Odbc.DataSource 做导航和 schema discovery 时能够观察到这个内部列。

    已在 ODBC 侧临时过滤 __mo_cpkey_col 和 __mo_fake_pk_col,以避免 Power BI 模型导入内部物理列;但根因仍建议在 MatrixOne 的用户可见元数据层修复,保证 information_schema.columns、SHOW COLUMNS、SELECT * 三者一致。

  2. added
    kind/bug
    severity/s0
    on Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bugseverity/s0

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions