-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Inconsistent ALTER behaviour. #8669
Copy link
Copy link
Closed
Labels
bugConfirmed user-visible misbehaviour in official releaseConfirmed user-visible misbehaviour in official release
Description
Describe the bug or unexpected behavior
Modification of type of column with non-materialized defaults leads to wrong default values.
How to reproduce
CREATE TABLE test_alter_on_mutation
(
date Date,
key UInt64
)
ENGINE ReplicatedMergeTree('/clickhouse/tables/test_alter_on_mutation', '1')
ORDER BY key;
INSERT INTO test_alter_on_mutation select toDate('2020-01-05'), number from system.numbers limit 100;
ALTER TABLE test_alter_on_mutation ADD COLUMN value String DEFAULT '10';
SELECT sum(cast(value as UInt64)) from test_alter_on_mutation;
┌─sum(CAST(value, 'UInt64'))─┐
│ 1000 │
└────────────────────────────┘
-- OPTIMIZE TABLE test_alter_on_mutation FINAL;
ALTER TABLE test_alter_on_mutation MODIFY COLUMN value UInt64;
SELECT sum(value) from test_alter_on_mutation;
┌─sum(value)─┐
│ 0 │
└────────────┘
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugConfirmed user-visible misbehaviour in official releaseConfirmed user-visible misbehaviour in official release