Skip to content

[Bug]: information_schema.tables exposes internal temporary table objects #25405

Closed

Description

@Ariznawlll

Environment

  • Branch: latest main
  • MO git version: 51656deb6
  • MySQL oracle: 8.0.45

Reference behavior

MySQL temporary tables are session-local objects and do not conflict with normal tables of the same name:
https://dev.mysql.com/doc/refman/8.0/en/create-temporary-table.html

Reproduce

drop database if exists mysql_compat_model12_temp_min;
create database mysql_compat_model12_temp_min;
use mysql_compat_model12_temp_min;

create table t_shadow (id int primary key, v varchar(20));
create temporary table t_tmp_meta (
  id int primary key,
  v varchar(20),
  key idx_v(v)
);

select table_name, table_type
from information_schema.tables
where table_schema = database()
order by table_name;

MySQL result

TABLE_NAME  TABLE_TYPE
t_shadow    BASE TABLE

MO result

table_name                                                                                                                 table_type
__mo_tmp_019f25c5a66f7178a8ab327288a5618f_mysql_compat_model12_temp_min___mo_index_secondary_019f25c5-a69d-70c3-b447-aaa76a159546  INTERNAL TABLE
__mo_tmp_019f25c5a66f7178a8ab327288a5618f_mysql_compat_model12_temp_min_t_shadow                                                 BASE TABLE
__mo_tmp_019f25c5a66f7178a8ab327288a5618f_mysql_compat_model12_temp_min_t_tmp_meta                                               BASE TABLE
t_shadow                                                                                                                   BASE TABLE

Expected

User-visible information_schema.tables should not expose internal temporary-table storage tables such as __mo_tmp_... or temporary secondary-index storage objects.

Activity

  1. added this to the MO-202607 milestone on Jul 3, 2026
  2. added
    kind/bug
    on Jul 3, 2026
  3. added theissue type on Jul 3, 2026
  4. added
    ai-easy
    on Jul 30, 2026
  5. Ariznawlll commented on Aug 5, 2026

    @Ariznawlll
    CollaboratorAuthor

    测试版本

    • 分支:main
    • commit:e31ee06042bc708ac5620a579715e07ec31c21b6
    • 部署方式:本地隔离单 LOG/TN/CN,临时表及 information_schema 元数据查询
    • 测试日期:2026-08-05

    原问题验证

    创建带主键、唯一键和二级索引的临时表后,information_schema.tables 连续 3/3 仅显示两个合法永久表,没有暴露临时基表或其内部索引物理对象。

    Happy Path 覆盖

    1. 临时表本身在创建 session 内可正常写入并读回 (1,10)。
    2. 普通永久表正常显示。
    3. 用户合法创建的 __mo_tmp_customer 永久表仍显示,未被宽前缀过滤误伤。

    Unhappy Path 覆盖

    1. TABLES、COLUMNS、STATISTICS、TABLE_CONSTRAINTS 四个 metadata view 均未泄漏临时基表或临时索引。
    2. 严格临时物理名前缀的 TABLES 泄漏计数为 0。
    3. 元数据查询之后临时数据和 session 均保持可用。

    白盒验证

    修复 PR #26298 已覆盖 catalog 标记、系统 view 过滤和 legacy temporary table 判定;本轮重点验证用户可见元数据和正常前缀表控制。

    回归测试

    MatrixOne 已有扩展 BVT:temporary_table_basic.sql,覆盖四个 metadata view、临时索引和合法前缀永久表,无需重复加入 motr。

    测试证据

    三轮 TABLES 结果仅为 __mo_tmp_customer 和 permanent_table,临时物理对象计数为 0,临时表读回 (1,10),session_usable=1。

    测试结论

    测试通过。

  6. Ariznawlll commented on Aug 9, 2026

    @Ariznawlll
    CollaboratorAuthor

    测试版本

    • 分支:main
    • commit:08770e1beeb23239c91165492f2fe85243a3c66a
    • 部署方式:本地隔离单 CN/单 TN/LogService;同一 SQL 与本地 MySQL 8 对照
    • 测试日期:2026-08-09

    原问题验证

    永久表 t_shadow 与带二级索引的临时表 t_tmp_meta 并存时,information_schema.tables 连续 3/3 仅返回 t_shadow / BASE TABLE,不再暴露 __mo_tmp_... 或临时二级索引内部对象。

    Happy Path 覆盖

    1. 永久 PK 表正常出现在 information_schema。
    2. 同会话临时表及其二级索引正常创建,但不出现在用户可见 tables 元数据。

    Unhappy Path 覆盖

    临时对象创建后立即查询 catalog,三轮内部对象计数均为 0;数据库删除后无残留对象。

    白盒验证

    不适用:问题是用户可见 information_schema 投影,公共 SQL 已直接验证。

    回归测试

    已加入 motr PR #85:suites/14_issue_regression/t/issue_25405_information_schema_temp_tables.test。result 由 MySQL 录制,MO 3 轮通过。

    测试证据

    • MySQL oracle 与 MO 输出均为唯一永久表。
    • 定向 3 轮通过;合并定向集 24/24 case 成功。

    测试结论

    测试通过。

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

Metadata

Metadata

Assignees

Labels

ai-easykind/bugphase/testing

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions