Skip to content

Add regression test for INSERT into table referenced by materialized view via renaming subquery JOIN - #108079

Merged
alexey-milovidov merged 3 commits into
masterfrom
mv-insert-renaming-subquery-join
Jun 29, 2026
Merged

alexey-milovidov merged 3 commits into
masterfrom
mv-insert-renaming-subquery-join

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Jun 21, 2026 •

Copy link
Copy Markdown
Member

Closes: #836

Issue #836 reported that inserting into a table referenced by a materialized view failed with a confusing Not found column low_un in block. There are only columns: ... error, when the view's SELECT referenced the source table inside a column-renaming subquery on one side of a JOIN.

This no longer reproduces on current master: the INSERT succeeds and the materialized view receives the correctly joined rows. Verified with the exact structure from the report (a renaming subquery on the left of an ALL INNER JOIN, with a UNION ALL on the right, joined USING low_un), under both the new analyzer (default) and the old analyzer (enable_analyzer=0), with identical output.

This pull request adds a stateless regression test so the scenario stays fixed. The analyzer is not randomized by the test harness, so the test is a shell script that runs the scenario explicitly under both enable_analyzer = 0 and enable_analyzer = 1.

Changelog category (leave one):

  • Build/Testing/Packaging Improvement

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

Added a regression test for inserting into a table referenced by a materialized view whose query joins a column-renaming subquery using USING, under both analyzers.

Version info

  • Merged into: 26.7.1.220 (included in 26.7 and later)

…view via renaming subquery JOIN

Inserting into a table that a materialized view references inside a
column-renaming subquery on one side of a JOIN used to fail with a
confusing `Not found column low_un in block` error. The scenario now
works correctly on master (the insert succeeds and the view receives
the correctly joined rows), so add a stateless regression test.

Closes: #836

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Jun 21, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [94dd389]

Summary: ✅


AI Review

Summary

This PR adds a stateless regression shell test for inserting into a table referenced by a materialized view whose query joins a column-renaming subquery with USING. The current version covers both enable_analyzer = 0 and enable_analyzer = 1, matching the prior review request and the linked issue discussion. I found no remaining blockers or major concerns.

Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-build Pull request with build/testing/packaging improvement label Jun 21, 2026
…n test

The new test `04403_mv_insert_renaming_subquery_join` used `lowerUTF8`,
which requires ICU and is therefore unavailable in the Fast test build
(`lowerUTF8.cpp` is guarded by `#if USE_ICU`), so the test failed with
`Function with name lowerUTF8 does not exist`. The function was only used
for case-insensitive matching of ASCII data, so replace it with `lower`,
which yields identical results on this data and is always available.

Also convert the test from `.sql` to `.sh` and run the scenario under both
`enable_analyzer = 0` and `enable_analyzer = 1`, as suggested by the reviewer.
The analyzer setting is not randomized by the stateless test harness, so the
old-analyzer path (which the issue closure also claims to be fixed) was not
actually exercised by the single-run `.sql` test.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 85.40% 85.40% +0.00%
Functions 92.60% 92.60% +0.00%
Branches 77.60% 77.60% +0.00%

Changed lines: No C/C++ source files changed — skipping uncovered code analysis.

Newly covered by added/modified tests: 378 line(s), 16 function(s) across 125 file(s) · Details

Top files
  • src/Functions/FunctionShowCertificate.cpp: 37 line(s), 3 function(s)
  • src/Storages/StorageReplicatedMergeTree.cpp: 26 line(s)
  • src/Disks/IO/CachedOnDiskWriteBufferFromFile.cpp: 15 line(s)
  • src/AggregateFunctions/AggregateFunctionQuantileGK.cpp: 14 line(s)
  • src/Interpreters/HashJoin/HashJoin.cpp: 11 line(s)

Full report

@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Jun 29, 2026
Merged via the queue into master with commit a15212f Jun 29, 2026
343 of 344 checks passed
@alexey-milovidov
alexey-milovidov deleted the mv-insert-renaming-subquery-join branch June 29, 2026 03:15
@robot-clickhouse robot-clickhouse added the pr-synced-to-cloud The PR is synced to the cloud repo label Jun 29, 2026
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
…ng-subquery-join

Add regression test for INSERT into table referenced by materialized view via renaming subquery JOIN
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-build Pull request with build/testing/packaging improvement 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.

Not able to import Data into a table referenced by Materialized View

3 participants