Repository navigation
Description
Is there an existing issue for the same feature request?
- I have checked the existing issues.
Is your feature request related to a problem?
Publication statements have inconsistent prepared-statement support. The original request covered ALTER PUBLICATION; the scope is expanded to match PR #29386 and complete the related publication management and inspection paths.
Frontend-handled statements need a valid PREPARE carrier and frontend execution rather than engine compilation. Publication SHOW statements also need consistent result metadata during preparation and execution.
Describe the feature you would like
Support SQL PREPARE / EXECUTE and MySQL binary-protocol prepared statements for:
CREATE PUBLICATIONALTER PUBLICATIONDROP PUBLICATIONSHOW PUBLICATIONS, including literal LIKE patterns and the supportedSHOW PUBLICATIONS LIKE ?string-pattern bindingSHOW PUBLICATION COVERAGE
Preserve and regression-test the existing SHOW CREATE PUBLICATION query path; this is not a newly introduced implementation for that statement.
Expected behavior:
- PREPARE must not create, alter, or drop a publication.
- EXECUTE must use the existing handlers, authorization, and current publication state, including repeated execution and errors after deletion or access revocation.
- Publication SHOW statements must expose consistent column names, counts, and wire types at PREPARE and execution, including empty results.
- SHOW results must remain compatible with
save_query_resultandRESULT_SCANafter wire metadata normalization. - Prepared statements must remain usable after an execution error when the underlying publication state becomes valid again.
Describe implementation you have considered
- Reuse the existing frontend-only prepared-statement path for the five statements listed above.
- Share publication SHOW result schemas between preparation and execution instead of maintaining separate metadata definitions.
- Recognize text BLOB-family wire metadata as internal TEXT when materializing saved frontend results, without treating binary BLOBs as TEXT.
- Bind a single string parameter for
SHOW PUBLICATIONS LIKE ?during prepared execution; reject unbound, non-string or otherwise invalid patterns without corrupting the prepared handle. Other nonliteral LIKE expressions are not implied to be supported. - Add planner/frontend/protocol unit tests and publication SQL regression coverage.
Documentation, Adoption, Use Case, Migration Strategy
This scope enables applications to prepare publication management and inspection statements without changing publication management semantics. SHOW PUBLICATIONS LIKE ? is a narrow supported parameter-marker case, not a general promise that publication names, account names, identifiers, or arbitrary publication statement fields accept ?.
Out of scope:
- Parameter markers for publication identifiers or other unlisted statement fields.
- Subscription-management statement support.
- Changes to authorization rules, catalog/storage formats, or unrelated publication behavior.
Additional information
Implementation PR: #29386. The expanded scope includes the result-metadata and saved-result compatibility work required by prepared publication SHOW statements, not only the original ALTER PUBLICATION entry point.
The current main also supports the narrow SHOW PUBLICATIONS LIKE ? path, covered by pkg/frontend/prepared_publication_parameter_test.go and test/distributed/cases/publication_subscription/prepare_publication.sql. This corrects the earlier out-of-scope wording; it does not expand support to arbitrary placeholders.
Activity
allengaoo commentedon Nov 4, 2024
suggest delay this one to 2.1.0
feat(frontend): support prepared publication statements (#29386)
[-][Feature Request]: Prepared statement support for `alter publication`[/-][+][Feature Request]: Prepared statement support for publication management and inspection[/+]Ariznawlll commentedon Oct 3, 2026
测试版本
main529ee099e32ed8c38d2806043bf1516ab0345e45原问题验证
SQL PREPARE/EXECUTE 和 MySQL 二进制 prepared 路径均验证了 CREATE / ALTER / DROP PUBLICATION、SHOW PUBLICATIONS、SHOW CREATE PUBLICATION、SHOW PUBLICATION COVERAGE。PREPARE 本身未创建、修改或删除 publication;EXECUTE 使用当前对象状态和权限。SHOW 空结果与有结果时均保持相同的 8 列名称和 wire types;
save_query_result后的RESULT_SCAN可读取结果。正常路径覆盖
main还支持窄范围的SHOW PUBLICATIONS LIKE ?字符串参数绑定;这与 issue 正文此前写的“不支持参数化 LIKE”不一致,正文已同步更正,不将此支持外推到 publication 标识符或任意参数标记。边界与错误路径覆盖
SHOW PUBLICATIONS LIKE ?的缺失绑定及不合适的类型被拒绝;错误后再以有效字符串参数执行,handle 仍可用。该窄范围参数合同见定向 UT。白盒验证
本轮以 SQL 与真实 binary-protocol 黑盒结果为主;已合入的 frontend UT 检查参数绑定、wire metadata、错误后的 handle 复用与执行时权限。没有新增故障注入。
回归测试
修复 #29386 已合入;publication prepared BVT及参数绑定 UT覆盖对象生命周期、LIKE 参数、授权和结果元数据。此问题不由数据规模触发,不新增 big-data 用例。
测试证据
上述 BVT、UT 文件及已合入的 #29386;本轮 SQL/binary 协议复测结果如上。自测试 commit 至当前官方
main,publication 专属回归与参数绑定测试文件未变更。测试结论
测试通过。