Skip to content

ALTER DELETE unexpectedly deletes NULL rows #9088

@chu1070y

Description

@chu1070y

When I delete specific rows, CH also delete NULL rows too.
Is it normal?
How can I control this?

SELECT *
FROM test2

┌──EventDate─┬─CounterID─┬─UserID─┐
│ 2020-01-02 │           │      2 │
│ 2020-01-03 │ aaa       │      0 │
└────────────┴───────────┴────────┘
┌──EventDate─┬─CounterID─┬─UserID─┐
│ 2020-01-02 │           │      2 │
│ 2020-01-02 │           │      2 │
│ 2020-01-02 │ ᴺᵁᴸᴸ      │      2 │
│ 2020-01-03 │ aaa       │      0 │
│ 2020-01-03 │ aaa       │      0 │
│ 2020-01-03 │ aaa       │   ᴺᵁᴸᴸ │
└────────────┴───────────┴────────┘

8 rows in set. Elapsed: 0.002 sec. 


ALTER TABLE test2
    DELETE WHERE UserID = 0


Ok.

0 rows in set. Elapsed: 0.085 sec. 


SELECT *
FROM test2

┌──EventDate─┬─CounterID─┬─UserID─┐
│ 2020-01-02 │           │      2 │
└────────────┴───────────┴────────┘
┌──EventDate─┬─CounterID─┬─UserID─┐
│ 2020-01-02 │           │      2 │
│ 2020-01-02 │           │      2 │
│ 2020-01-02 │ ᴺᵁᴸᴸ      │      2 │
└────────────┴───────────┴────────┘

4 rows in set. Elapsed: 0.002 sec. 

Metadata

Metadata

Labels

bugConfirmed user-visible misbehaviour in official releasecomp-datatype-wrapperType modifiers/wrappers (Nullable, LowCardinality, etc.).comp-mutationsALTER UPDATE/DELETE and mutation execution over parts (including lightweight updates/deletes).major

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions