Skip to content

Docs: document ALTER TABLE ... EXECUTE, MOVE PART ... TO SHARD, SHOW PRIVILEGES and other statements - #131673

Open
groeneai wants to merge 5 commits into
ClickHouse:masterfrom
groeneai:docs-execute-move-to-shard-show-copy
Open

groeneai wants to merge 5 commits into
ClickHouse:masterfrom
groeneai:docs-execute-move-to-shard-show-copy

Conversation

@groeneai

@groeneai groeneai commented Nov 14, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #131085

Changelog category (leave one):

  • Documentation (changelog entry is not required)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Document ALTER TABLE ... EXECUTE, ALTER TABLE ... MOVE PART ... TO SHARD, SHOW MASKING POLICIES, SHOW PRIVILEGES, DESCRIBE FILESYSTEM CACHE and the PostgreSQL COPY ... TO STDOUT / COPY ... FROM STDIN statements.

Description

Last of the PRs for the statements without reference documentation that @ Blargian asked for in #131085. All of them parse on master but had no reference section.

  • ALTER TABLE ... EXECUTE: new ALTER sub-page. Only Iceberg tables implement commands (expire_snapshots since v26.3, remove_orphan_files since v26.4, both experimental); the command details stay on the iceberg table function page, which the page links.
  • MOVE PART ... TO SHARD: new section of the ALTER TABLE ... PARTITION page (experimental, part_moves_between_shards_enable).
  • SHOW MASKING POLICIES (Cloud only) and SHOW PRIVILEGES: new sections at the end of the SHOW page, so no existing anchor is renumbered. The SHOW POLICIES syntax line gains the name filter the parser accepts.
  • DESCRIBE FILESYSTEM CACHE: its own page (the parser gains getDocumentation and is registered), since it describes a cache, not a table.
  • COPY: new section of the hand-written PostgreSQL interface page, because only that protocol runs it (native and HTTP return UNKNOWN_TYPE_OF_QUERY).

MOVE PART ... TO SHARD and COPY ... FROM STDIN were not in the earlier list. Each page states the version the statement was introduced in (first release tag with the parser code) and marks experimental features with the badge and a note naming the setting.

Validation: every behaviour and example was observed on a server built from this branch. I regenerated the pages with autogenerate_docs.py --write --only 'statement:' and ran lychee_check.py --mode links (0 errors), navigation_check.py, mint validate (no finding on these pages) and check_autogenerated_regions.py, each also with a corrupted input that it reports; links inside <Note>, which lychee skips, were resolved by a script. The committed tree contains no generated text. 04926_system_statements fails without the two new reference lines and passes with them.

🤖 Generated with Claude Code


Workflow [PR]
Sync PR [sync-upstream/pr/131673]

groeneai and others added 3 commits November 14, 2026 16:29
…PRIVILEGES and other statements

Add reference documentation, through the source registrations the docs
generator reads, for statements that parse on master but had no reference
section:

- ALTER TABLE ... EXECUTE: a new ALTER sub-page (registration in
  ParserAlterQuery, a row in the ALTER overview). Only Iceberg tables
  implement commands (expire_snapshots since v26.3, remove_orphan_files since
  v26.4, both experimental); other engines throw NOT_IMPLEMENTED. The command
  details stay on the iceberg table function page, which the new page links.
- ALTER TABLE ... MOVE PART ... TO SHARD: a section of the PARTITION page.
  Experimental (MergeTree setting part_moves_between_shards_enable of the
  source table), ReplicatedMergeTree only, needs part UUIDs, only schedules
  the move (system.part_moves_between_shards).
- SHOW MASKING POLICIES (Cloud only) and SHOW PRIVILEGES: two sections at the
  end of the SHOW page, so no existing anchor is renumbered. The SHOW POLICIES
  syntax line gains the name filter the parser accepts.
- DESCRIBE FILESYSTEM CACHE: its own page (the parser gains
  getDocumentation and is registered), since it describes a cache, not a
  table; a DESCRIBE TABLE section would also turn that page into a full-page
  description.
- COPY ... TO STDOUT / FROM STDIN: a section of the hand-written PostgreSQL
  interface page, because only the PostgreSQL protocol runs COPY (the native
  and HTTP interfaces return UNKNOWN_TYPE_OF_QUERY).

Each page states when the statement was introduced (first release tag that
contains the parser code) and marks experimental features with the
ExperimentalBadge and a Note naming the enabling setting. Every behaviour
stated was observed on a server built from this branch. Generated regions are
left empty; the nightly regeneration fills them.

Related: ClickHouse#131085

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- `SHOW PRIVILEGES` is in the first 20.5 release (v20.5.2.7-stable), and
  `MOVE PART ... TO SHARD` in the first 21.7 release (v21.7.2.7-stable).
  The earlier probe read the first `-testing` tag of each series, which was
  cut before these merges.
- `ALTER TABLE ... EXECUTE` on a non-Iceberg table: MergeTree throws
  `NOT_IMPLEMENTED`, while Delta Lake, Hudi and Paimon tables reach the base
  `IDataLakeMetadata::executeCommand`, which throws `UNSUPPORTED_METHOD`. Say
  "throws an exception" instead of naming one code.
- The `MOVE PART ... TO SHARD` example now creates the `shard1` and `shard2`
  databases it uses.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`PostgreSQLHandler::processParseQuery` rejects any `COPY` in a `Parse`
message, because the CopyIn/CopyOut exchange exists only on the simple-query
path. The client sees SQLSTATE `2F000` with the message "COPY is not supported
in extended PostgreSQL protocol queries" (the `NOT_IMPLEMENTED` code is not
sent), so the page quotes the message. Observed with psql 16 `\bind \g` for
both `TO STDOUT` and `FROM STDIN`; `psql -c`, `\copy` and psycopg 3
`cursor.copy` send a simple query and work.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai

Copy link
Copy Markdown
Collaborator Author
Internal second-model review: adjudication log (click to expand)

Pre-publication review by an independent model (engine: codex; 3 rounds, 4 findings) plus my own review (3 rounds).

# Sev Finding Verdict Evidence / action
1 ⚠️ ALTER TABLE ... EXECUTE page said other tables throw NOT_IMPLEMENTED; other data lake tables throw UNSUPPORTED_METHOD (IDataLakeMetadata.h:267-270) AGREE, fixed reworded to "throws an exception"
2 ⚠️ SHOW PRIVILEGES introduced in v20.5, not v20.6 (v20.5.2.7-stable contains it) AGREE, fixed version corrected
3 ⚠️ MOVE PART ... TO SHARD introduced in v21.7, not v21.8 (v21.7.2.7-stable contains it) AGREE, fixed version corrected
4 💡 MOVE PART ... TO SHARD example used databases it never creates AGREE, fixed CREATE DATABASE lines added
5 ⚠️ COPY over the extended query protocol is rejected (PostgreSQLHandler::processParseQuery), which the COPY section did not say AGREE, fixed one bullet added with the error message the client receives, observed with psql \bind

Severity: ❌ blocker / ⚠️ major / 💡 nit. DISAGREE verdicts carry recorded evidence and are
terminal per finding.

@mintlify

mintlify Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Preview approval required

This pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit 4e23dee.

Approve preview

@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes: the master binary registers neither ALTER TABLE ... EXECUTE nor DESCRIBE FILESYSTEM CACHE in system.statements, and 04926_system_statements with the new reference lines fails without them.
b Root cause explained? Statement pages are generated from the documentation of the registered parsers. ParserAlterQuery had no EXECUTE entry, the PARTITION entry documented MOVE PART only TO DISK|VOLUME, the SHOW entry had no SHOW PRIVILEGES / SHOW MASKING POLICIES, ParserDescribeCacheQuery had no documentation and no registration, and COPY was missing from the PostgreSQL interface page, the only interface that runs it.
c Fix matches root cause? Yes: the documentation is added at the source the generator reads; the two new pages have only frontmatter and empty markers, and no generated region is edited. postgresql.mdx is hand-written and edited directly.
d Test intent preserved / new tests added? 04926_system_statements (the list of registered statements) gets the two new names. No test of the docs pipeline itself.
e Both directions demonstrated? Yes: branch binary + old reference fails, branch binary + new reference passes 10/10 with randomized settings. Each docs check also run on a corrupted input, which it reports: generator without the new page, lychee on corrupted anchors, navigation check without the entry, mint validate without a badge import, the generated-regions check on a hand edit.
f Fix is general across code paths? All six statements in scope are covered, COPY in both directions. The SHOW POLICIES syntax line, served by the same parser branch as SHOW MASKING POLICIES, gains the name filter it accepts.
g Fix generalizes across inputs (params/datatypes/wrappers)? N/A (documentation). Each documented behaviour was run on a server built from this branch: native, HTTP, local and PostgreSQL interfaces, with and without privileges, text and CSV, every NULL/QUOTE/DELIMITER variant, the move-to-shard setting on source and destination.
h Backward compatible? (maintainer-approved exception only) Yes: documentation strings and a documentation-only registration; no behaviour, setting or format change.
i Invariants and contracts preserved? Yes: one page per registered name with a matching title, every related name registered (04926), unique header anchors, every added link resolves on the regenerated pages (including links inside <Note>, which lychee skips).

Session id: cron:clickhouse-impl-slot-7:20261114-154300

@clickhouse-gh

clickhouse-gh Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [4e23dee]

Summary: ❌

job_name test_name status info comment
Build profile diff ERROR

AI Review

Summary

Documents ALTER TABLE ... EXECUTE, MOVE PART ... TO SHARD, SHOW MASKING POLICIES, SHOW PRIVILEGES, DESCRIBE FILESYSTEM CACHE, and PostgreSQL COPY, with parser registrations and reference page navigation. No actionable findings at PR head 4e23dee52285798e032e4de011c6ba74cc568ee1. The updated 04926_system_statements test passes in Fast test CI.

Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added pr-documentation Documentation PRs for the specific code PR can be tested Allows running workflows for external contributors comp-documentation Documentation (docs, examples, READMEs). labels Nov 14, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - 11e1b01

Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
whose fixing-PR link will be posted here when it opens. Only CH Inc sync is exempt.

Check / test Reason Owner / fixing PR
Build profile diff infra, not from this PR: the job stopped before any comparison, because all 8 readiness probes (SELECT 1) to the CI logs cluster hit the 3 s read timeout and it raised LogClusterNotReady: the endpoint never became ready in has_pr_data. The same error hit 11 other PRs between 20:51Z and 22:01Z #129675 (mine, open)

Session id: cron:our-pr-ci-monitor:20261114-223011

Master enabled the clang-tidy check modernize-use-nodiscard (ClickHouse#126158),
and the new override declaration lacked the attribute, so Build (arm_tidy)
would fail on the merge commit, as it did on master for
ParserTransactionControl.h.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - b564fdb

Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
whose fixing-PR link will be posted here when it opens. Only CH Inc sync is exempt.

Check / test Reason Owner / fixing PR
Build (arm_tidy, 2/4) not from this PR: master is red the same way since #126158 enabled modernize-use-nodiscard; the only error is src/Parsers/ParserTransactionControl.h:12:5: function 'getDocumentation' should be marked [[nodiscard]], a file this PR does not touch #131891 (external, open)
Build (arm_tidy, 3/4) same error as 2/4 #131891 (external, open)
Build (arm_tidy, 4/4) same error as 2/4; these three failures dropped 94 dependent jobs, which did not run on this head #131891 (external, open)
Sync - CH Inc sync (private, not actionable by me)

Session id: cron:our-pr-ci-monitor:20261116-030011

@Blargian Blargian self-assigned this Nov 16, 2026

@clickhouse-gh clickhouse-gh Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI review approves this commit, see the AI Review comment.

This branch has not been deployed

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

Labels

can be tested Allows running workflows for external contributors comp-documentation Documentation (docs, examples, READMEs). pr-documentation Documentation PRs for the specific code PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants