Skip to content

Revert "Reject ATTACH TABLE with storage clauses but no ENGINE" - #105032

Merged
Algunenano merged 1 commit into
masterfrom
revert-104800-groeneai/fix-104791-attach-table-settings-silent-ignore
May 15, 2026
Merged

Algunenano merged 1 commit into
masterfrom
revert-104800-groeneai/fix-104791-attach-table-settings-silent-ignore

Conversation

@Algunenano

@Algunenano Algunenano commented May 15, 2026 •

Copy link
Copy Markdown
Member

Reverts #104800

Broke CI

Version info

  • Merged into: 26.5.1.678

@Algunenano
Algunenano enabled auto-merge May 15, 2026 13:55
@clickhouse-gh

clickhouse-gh Bot commented May 15, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [f0500bd]


AI Review

Summary

This PR cleanly reverts #104800 by removing the ATTACH TABLE ... guard in InterpreterCreateQuery and deleting its matching stateless regression test. The changes are minimal and internally consistent with the revert intent; I did not find new correctness, safety, or performance defects introduced by this revert itself.

Final Verdict

Status: ✅ Approve

@Algunenano
Algunenano added this pull request to the merge queue May 15, 2026
@clickhouse-gh clickhouse-gh Bot added the pr-not-for-changelog This PR should not be mentioned in the changelog label May 15, 2026
Merged via the queue into master with commit bd18c35 May 15, 2026
16 of 29 checks passed
@Algunenano
Algunenano deleted the revert-104800-groeneai/fix-104791-attach-table-settings-silent-ignore branch May 15, 2026 14:09
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-synced-to-cloud The PR is synced to the cloud repo label May 15, 2026
pull Bot pushed a commit to Spencerx/ClickHouse that referenced this pull request May 22, 2026
Re-land of ClickHouse#104800 with a narrower guard that does not break
`ATTACH TABLE t SETTINGS log_comment = 'foo';`. PR ClickHouse#104800 was reverted in
ClickHouse#105032 because it rejected that pattern, which internal CI relies on
(reported by @Algunenano on ClickHouse#104791).

`InterpreterSetQuery::applySettingsFromQuery` runs in `executeQueryImpl`
before `InterpreterCreateQuery::createTable` and hoists session settings
out of `create.storage->settings` into the context, resetting
`storage->settings` to `nullptr` when nothing engine-specific is left.
The reverted guard fired only on the existence of an `ASTStorage` without
an `engine`, so by the time it ran the storage object had already been
emptied — rejecting the legitimate `log_comment` shape.

The narrower guard checks the individual non-engine fields
(`partition_by`, `primary_key`, `order_by`, `sample_by`, `ttl_table`,
`unique_key`, `settings`) so it only rejects when there is something the
short-`ATTACH` path would actually drop:

  ATTACH TABLE t;                                  OK (short ATTACH)
  ATTACH TABLE t SETTINGS log_comment = 'foo';     OK (session bind)
  ATTACH TABLE t SETTINGS index_granularity = 100; BAD_ARGUMENTS
  ATTACH TABLE t SETTINGS max_part_loading_threads = 16; BAD_ARGUMENTS
  ATTACH TABLE t ORDER BY id;                      BAD_ARGUMENTS
  ATTACH TABLE t PARTITION BY id;                  BAD_ARGUMENTS

Regression test `04247_attach_table_storage_clauses_without_engine_error`
covers all six cases.

Closes ClickHouse#104791.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-not-for-changelog This PR should not be mentioned in the changelog 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