Skip to content

Commit 209637f

Browse files
authored
Merge pull request ClickHouse#91688 from ClickHouse/backport/25.8/91040
Backport ClickHouse#91040 to 25.8: Fix reading dynamic subcolumns from materialized columns in mutations
2 parents d1a6828 + e1432be commit 209637f

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

src/Interpreters/TreeRewriter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1225,7 +1225,7 @@ bool TreeRewriterResult::collectUsedColumns(const ASTPtr & query, bool is_select
12251225
/// Check for subcolumns in unknown required columns.
12261226
if (!unknown_required_source_columns.empty() && (!storage || storage->supportsSubcolumns()))
12271227
{
1228-
for (const NameAndTypePair & pair : source_columns_ordinary)
1228+
for (const NameAndTypePair & pair : required_source_columns)
12291229
{
12301230
for (auto it = unknown_required_source_columns.begin(); it != unknown_required_source_columns.end();)
12311231
{
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
drop table if exists test;
2+
create table test (s String, json JSON materialized s) engine=MergeTree order by tuple();
3+
insert into test select '{"a" : 42}';
4+
alter table test update s = '{}' where json.a = 42 settings mutations_sync=1;
5+
select * from test;
6+
drop table test;
7+

0 commit comments

Comments
 (0)