Skip to content

[Feature Request]: Support parameterized SHOW PUBLICATIONS LIKE in prepared statements #29388

Closed

Description

@XuPeng-SH

Is there an existing issue for the same feature request?

  • I have checked the existing issues.

Is your feature request related to a problem?

SHOW PUBLICATIONS LIKE 'pattern' can be prepared and executed with a literal pattern, but a parameter marker is currently rejected at PREPARE:

PREPARE pub_show FROM 'SHOW PUBLICATIONS LIKE ?';
-- not supported: prepared SHOW PUBLICATIONS requires a string literal LIKE pattern

Applications that filter publications using a dynamic pattern cannot reuse a server-side prepared statement. This is a separate follow-up to #16543 and #29386; #29386 intentionally rejects nonliteral patterns rather than advertising zero parameters.

Describe the feature you'd like

Support a single string parameter in SHOW PUBLICATIONS LIKE ? for both SQL PREPARE / EXECUTE ... USING and MySQL binary protocol COM_STMT_PREPARE / COM_STMT_EXECUTE.

Expected example:

PREPARE pub_show FROM 'SHOW PUBLICATIONS LIKE ?';
SET @pattern = 'team_%';
EXECUTE pub_show USING @pattern;
SET @pattern = 'other_%';
EXECUTE pub_show USING @pattern;
DEALLOCATE PREPARE pub_show;

Acceptance criteria:

  • PREPARE reports exactly one string parameter and the existing eight result columns, without querying or changing publication state.
  • Each EXECUTE evaluates the current bound pattern using the same LIKE semantics as a literal SHOW PUBLICATIONS LIKE '...'; different bindings on one handle yield the corresponding rows, including an empty result with the same column metadata.
  • Both SQL and binary protocol execution work. Missing or invalid parameter bindings return an error without corrupting the prepared handle; it remains reusable on a later valid execution.
  • Authorization and publication visibility are evaluated at execution time.
  • Literal LIKE and SHOW PUBLICATIONS without LIKE keep their current behavior.

Describe implementation you've considered

The current frontend handler reads the LIKE right operand only when it is a string tree.NumVal; the planner explicitly rejects other forms in getPreparePlan. Parameter support needs the parameter metadata and an execution-time bound value to reach that frontend handler. Please use the existing prepared-parameter lifecycle and keep the SHOW result schema shared between PREPARE metadata and execution. This issue requests only the parameter marker; general arbitrary LIKE expressions are outside scope.

Documentation, Adoption, Use Case, Migration Strategy

Useful for JDBC and other clients that use server-side prepared statements to list publications by a user-supplied pattern, without constructing SQL text for each pattern.

Additional information

Related: #16543 and #29386. No dedicated existing issue was found by searching open and closed MatrixOne issues for prepared publication parameters or SHOW PUBLICATIONS LIKE ?.

Activity

  1. added
    severity/s1
    and removed on Sep 27, 2026
  2. Ariznawlll commented on Sep 27, 2026

    @Ariznawlll
    Collaborator

    测试版本

    • 分支:main
    • commit:5be6cd90b501da225be591ffffe6000bf01f515e
    • 部署方式:本地单机(1 CN / 1 TN / 1 LogService)
    • 测试日期:2026-09-27

    原问题验证

    按 issue 原始 SQL 在最新 main 上独立执行 3 次,结果 3/3 符合修复预期;确认修复提交 630afbe96cbbbfecc83d1f891256efb5d02df30b 已包含在当前 main。

    Happy Path 覆盖

    1. prepared SHOW PUBLICATIONS LIKE ? 在 motr_pub_a% 与 motr_pub_b% 两次绑定中各只返回对应 publication,空模式返回空集。

    Unhappy Path 覆盖

    1. 数字与 NULL 绑定返回 20301;随后重新绑定字符串仍成功,prepared handle 未损坏。

    白盒验证

    核对修复提交 630afbe96cbbbfecc83d1f891256efb5d02df30b、对应 BVT/UT 以及当前 main 的祖先关系;本次同时完成公开 SQL 协议验收。

    回归测试

    已加入 MOTR PR #204 的 issue_29388_prepared_show_publications.test,MOTR 提交 c7aeb11c;本地基线比对连续 3 次通过。

    测试证据

    测试结论

    测试通过。

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

Metadata

Metadata

Assignees

Labels

kind/featureseverity/s1

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions