Skip to content

Docs: move SQL statement pages into source - #115608

Merged
Blargian merged 11 commits into
ClickHouse:masterfrom
Blargian:codex/statement-docs-source
Aug 24, 2026
Merged

Blargian merged 11 commits into
ClickHouse:masterfrom
Blargian:codex/statement-docs-source

Conversation

@Blargian

@Blargian Blargian commented Aug 20, 2026 •

Copy link
Copy Markdown
Member

Moves the 99 canonical SQL statement reference page bodies into the Documentation::description fields introduced by #115341.

The Markdown pages keep their existing frontmatter and gain AUTOGENERATED_START / AUTOGENERATED_END markers around the source-owned body. system.documentation now exposes the same complete page body without appending duplicate structured sections. The statement index and 31 dictionary subtopic pages remain hand-written.

Related: #115341

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):


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

@clickhouse-gh

clickhouse-gh Bot commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [ba6df6a]

Summary: ❌

job_name test_name status info comment
CI Tests FAIL
ci/tests/test_settings_history_source_gate.py::test_renaming_a_record_in_place_is_allowed FAIL cidb

AI Review

Summary

This PR moves the 99 SQL statement page bodies into parser-side Documentation::description fields and switches system.documentation to expose those statement pages verbatim. The implementation itself looks coherent, but the checked-in system reference docs are still out of sync with the new source of truth, so the merged commit would publish missing or contradictory documentation.

Findings

⚠️ Majors

  • [src/Storages/System/attachSystemTables.cpp:215] system.statements is now a public system table, but the repo still has no generated docs/reference/system-tables/statements.mdx page (and therefore no navigation entry for it). Deferring that to a later nightly regeneration means this merge still ships a new table with no system-table reference page. Suggested fix: rerun utils/generate-system-tables-docs in this PR and commit the generated page/navigation update. [dismissed by author -- https://github.com/Docs: move SQL statement pages into source #115608#discussion_r3823040474]

  • [docs/reference/system-tables/documentation.mdx:55] The checked-in system.documentation schema docs are only partially regenerated: the type enum still stops at 'System Table' = 20, even though the runtime schema already exposes Statement = 21. That leaves the published reference page contradicting the live table schema. Suggested fix: regenerate docs/reference/system-tables/documentation.mdx from the current source/binary so the autogenerated columns block matches the table. [dismissed by author -- https://github.com/Docs: move SQL statement pages into source #115608#discussion_r3823040481]

  • [docs/reference/system-tables/documentation.mdx:47] The prose still says statement documentation “also names the enclosing statement”, but StorageSystemDocumentation now routes statements through addFullPageDocumented, and tests/queries/0_stateless/04927_system_documentation_statements.sql explicitly asserts there is no synthetic **Part of:** section in system.documentation.description. The page currently promises information that system.documentation does not expose. Suggested fix: rewrite this paragraph to describe the verbatim page body and point readers to system.statements.parent_name for the enclosing statement.

💡 Nits

  • [src/Storages/System/attachSystemTables.cpp:208-212] These shortened table comments are the source of truth for generated pages such as docs/reference/system-tables/dictionary_layouts.mdx, dictionary_sources.mdx, disk_types.mdx, and data_skipping_index_types.mdx, but the checked-in outputs still carry the pre-change “along with their embedded documentation” wording. The text is stale relative to the source comments, so the generator outputs should be rerun in the same PR. [dismissed by author -- https://github.com/Docs: move SQL statement pages into source #115608#discussion_r3843246296]
Final Verdict

Changes requested until the generated system documentation is synchronized and the system.documentation reference page no longer claims statement-parent information that the table does not return.

LLVM Coverage Report

Metric Baseline Current Δ
Lines 87.00% 87.20% +0.20%
Functions 91.90% 91.90% +0.00%
Branches 79.30% 79.30% +0.00%

Changed lines: Changed C/C++ lines covered: 12360/12360 (100.00%) · Uncovered code

Full report · Diff report

@clickhouse-gh clickhouse-gh Bot added the pr-documentation Documentation PRs for the specific code PR label Aug 20, 2026
Expect `system.documentation` to preserve complete statement pages without synthetic `Part of` sections, and synchronize the `EXPLAIN` statistics spelling after merging `master`.

Related: ClickHouse#115608
@Blargian Blargian added the pr-autogenerated-docs PR that regenerates docs artifacts from source; exempt from the autogenerated-region edit guard label Aug 20, 2026
attach<StorageSystemDocumentation>(context, system_database, "documentation", "Collects the embedded documentation of the components of the system (functions, table engines, data types, settings, profile events, metrics, system tables, etc.) into a single table, with the reference documentation rendered as Markdown and the path to the source file where it is defined.");
attach<StorageSystemCollations>(context, system_database, "collations", "Contains a list of all available collations for alphabetical comparison of strings.");
attach<StorageSystemDatabaseEngines>(context, system_database, "database_engines", "Contains a list of all available database engines");
attach<StorageSystemStatements>(context, system_database, "statements", "Contains a list of all SQL statements of ClickHouse.");

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.

system.statements is a new public system table, but this PR does not add the generated reference page under docs/reference/system-tables/. utils/generate-system-tables-docs creates one .mdx file per table from the table comment and column comments; without the generated statements.mdx, the website ships the new table with no system-table reference page at all.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It will get added during the nightly generation job

@clickhouse-gh

clickhouse-gh Bot commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing ba6df6ab6 with master 762e8e123 (stripped binary size, per-symbol sizes and ThinLTO time; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes
Binary Master PR Δ
programs/clickhouse-stripped 709.21 MiB 706.82 MiB -2.39 MiB (-0.34%)

Only the stripped binary is compared: the official master build keeps debug symbols while PR builds strip them, so the other binaries differ by construction.

Object file sizes

47 object files changed (+976.75 KiB total), 0 added.

Object file Master PR Δ
src/Parsers/CMakeFiles/clickhouse_parsers.dir/ParserSelectQuery.cpp.o 128.34 KiB 263.37 KiB +135.03 KiB (+105.21%)
src/Parsers/CMakeFiles/clickhouse_parsers.dir/ParserAlterQuery.cpp.o 211.77 KiB 344.83 KiB +133.06 KiB (+62.83%)
src/Parsers/CMakeFiles/clickhouse_parsers.dir/ParserCreateQuery.cpp.o 373.44 KiB 505.71 KiB +132.27 KiB (+35.42%)
src/Parsers/CMakeFiles/clickhouse_parsers.dir/ParserExplainQuery.cpp.o 54.55 KiB 127.31 KiB +72.76 KiB (+133.38%)
src/Parsers/CMakeFiles/clickhouse_parsers.dir/ParserTablesInSelectQuery.cpp.o 98.69 KiB 169.01 KiB +70.32 KiB (+71.26%)
src/Parsers/CMakeFiles/clickhouse_parsers.dir/ParserSystemQuery.cpp.o 196.12 KiB 256.13 KiB +60.01 KiB (+30.60%)
src/Parsers/CMakeFiles/clickhouse_parsers.dir/Access/ParserGrantQuery.cpp.o 58.52 KiB 108.30 KiB +49.79 KiB (+85.07%)
src/Parsers/CMakeFiles/clickhouse_parsers.dir/ParserShowTablesQuery.cpp.o 42.80 KiB 85.57 KiB +42.76 KiB (+99.90%)
src/Parsers/CMakeFiles/clickhouse_parsers.dir/Access/ParserCreateUserQuery.cpp.o 114.82 KiB 152.70 KiB +37.88 KiB (+32.99%)
src/Parsers/CMakeFiles/clickhouse_parsers.dir/ParserWithElement.cpp.o 45.30 KiB 71.12 KiB +25.82 KiB (+56.99%)
src/Parsers/CMakeFiles/clickhouse_parsers.dir/ParserSelectWithUnionQuery.cpp.o 42.39 KiB 66.41 KiB +24.02 KiB (+56.65%)
src/Parsers/CMakeFiles/clickhouse_parsers.dir/ParserOptimizeQuery.cpp.o 73.30 KiB 94.79 KiB +21.48 KiB (+29.31%)
src/Parsers/CMakeFiles/clickhouse_parsers.dir/ExpressionListParsers.cpp.o 522.21 KiB 543.46 KiB +21.25 KiB (+4.07%)
src/Parsers/CMakeFiles/clickhouse_parsers.dir/ParserInsertQuery.cpp.o 84.55 KiB 104.36 KiB +19.80 KiB (+23.42%)

737 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only clickhouse-bundle) and not compared.

Compile time of recompiled translation units

51 translation units recompiled, 110 s compile time in total, 51 of them have a recent master baseline.

Job report

# Conflicts:
#	docs/reference/statements/alter/named-collection.mdx
#	docs/reference/statements/alter/user.mdx
#	docs/reference/statements/create/named-collection.mdx
#	docs/reference/statements/create/user.mdx

For system tables, the documentation is the table comment together with the list of its columns (the name, type and description of each).

For SQL statements, the documentation is the same as the one exposed by `system.statements`: it also names the enclosing statement, if any, e.g. the `WHERE` clause is a part of `SELECT`.

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.

This sentence no longer matches the implementation. StorageSystemDocumentation now adds Statement rows with addFullPageDocumented, so system.documentation.description is just the trimmed page body from system.statements and does not append a synthetic **Part of:** section; tests/queries/0_stateless/04927_system_documentation_statements.sql asserts exactly that. As written, the published docs promise information that the table does not expose.

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.

The current code still defines addFullPageDocumented at src/Storages/System/StorageSystemDocumentation.cpp:370 and still routes statements through it at src/Storages/System/StorageSystemDocumentation.cpp:978, so system.documentation is still built from the trimmed page body and still omits the synthetic **Part of:** section.


For system tables, the documentation is the table comment together with the list of its columns (the name, type and description of each).

For SQL statements, the documentation is the same as the one exposed by `system.statements`: it also names the enclosing statement, if any, e.g. the `WHERE` clause is a part of `SELECT`.

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.

This sentence no longer matches the contract of the current implementation. StorageSystemDocumentation now adds Statement rows via addFullPageDocumented, and 04927_system_documentation_statements.sql explicitly checks that system.documentation does not append synthetic **Part of:** sections for statements. So the enclosing statement is only exposed via system.statements.parent_name; here the docs should describe the verbatim page body instead.

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.

The current code still defines addFullPageDocumented at src/Storages/System/StorageSystemDocumentation.cpp:370 and still routes statements through it at src/Storages/System/StorageSystemDocumentation.cpp:978, so system.documentation is still built from the trimmed page body and still omits the synthetic **Part of:** section.

@Blargian
Blargian enabled auto-merge August 24, 2026 13:14
@Blargian

Copy link
Copy Markdown
Member Author

@groeneai is it safe to merge?

@Blargian
Blargian disabled auto-merge August 24, 2026 19:56
@Blargian

Copy link
Copy Markdown
Member Author

Failing CI check addressed with #116107 or #115650

@Blargian
Blargian added this pull request to the merge queue Aug 24, 2026
Merged via the queue into ClickHouse:master with commit f6a91ed Aug 24, 2026
176 of 178 checks passed
@Blargian
Blargian deleted the codex/statement-docs-source branch August 24, 2026 20:33
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-autogenerated-docs PR that regenerates docs artifacts from source; exempt from the autogenerated-region edit guard pr-documentation Documentation PRs for the specific code PR pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants