-
Notifications
You must be signed in to change notification settings - Fork 8.3k
ALTER DELETE unexpectedly deletes NULL rows #9088
Copy link
Copy link
Closed
Labels
bugConfirmed user-visible misbehaviour in official releaseConfirmed user-visible misbehaviour in official releasecomp-datatype-wrapperType modifiers/wrappers (Nullable, LowCardinality, etc.).Type modifiers/wrappers (Nullable, LowCardinality, etc.).comp-mutationsALTER UPDATE/DELETE and mutation execution over parts (including lightweight updates/deletes).ALTER UPDATE/DELETE and mutation execution over parts (including lightweight updates/deletes).major
Description
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. Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugConfirmed user-visible misbehaviour in official releaseConfirmed user-visible misbehaviour in official releasecomp-datatype-wrapperType modifiers/wrappers (Nullable, LowCardinality, etc.).Type modifiers/wrappers (Nullable, LowCardinality, etc.).comp-mutationsALTER UPDATE/DELETE and mutation execution over parts (including lightweight updates/deletes).ALTER UPDATE/DELETE and mutation execution over parts (including lightweight updates/deletes).major