Skip to content

INSERT SELECT incorrectly fills MATERIALIZED column #29729

@tavplubix

Description

@tavplubix

Does it reproduce on recent release?
Reproduced on 21.11.1.1 (master) and 21.9.2
Works as expected on 21.8.2, so it's regression

How to reproduce

:) create table mt (id Int64, A Nullable(Int64), X Int64 materialized coalesce(A, -1)) engine=MergeTree order by id
:) insert into mt values (1, 42)  -- X will be 42 (as expected)
:) insert into mt select 1, 42    -- X will be -1
:) select *, X from mt order by id
┌─id─┬──A─┬──X─┐
│  1 │ 42 │ 42 │
└────┴────┴────┘
┌─id─┬──A─┬──X─┐
│  1 │ 42 │ -1 │
└────┴────┴────┘

Expected behavior

:) select *, X from mt order by id
┌─id─┬──A─┬──X─┐
│  1 │ 42 │ 42 │
└────┴────┴────┘
┌─id─┬──A─┬──X─┐
│  1 │ 42 │ 42 │
└────┴────┴────┘

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugConfirmed user-visible misbehaviour in official release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions