ClickHouse / ClickHouse/ClickHouse

Unclear error message on insert when materialized view query have different column name from parent table

Open
#26,240 0 comments 0 reactions 0 assignees View on GitHub
comp-materialized-view external usability
Dominant language
C++
Stars
49.9k
Forks
9k
Avg merge
21h 32m
Merged PRs (30d)
515

Description

Trying to rename a column by dropping:

```
CREATE TABLE foo(id UInt64) ENGINE=ReplacingMergeTree() ORDER BY id;
CREATE MATERIALIZED VIEW bar ENGINE=MergeTree() ORDER BY x AS SELECT id+1 AS x FROM foo;
DROP TABLE foo; -- <-- should show warning
CREATE TABLE foo(bla UInt64) ENGINE=ReplacingMergeTree() ORDER BY bla;
INSERT INTO foo(bla) VALUES(1); -- <-- should show which MV caused the error, since i have lots of materialized view
-- Code: 47. DB::Exception: Received from localhost:9000. DB::Exception: Missing columns: 'id' while processing query: 'SELECT id + 1 AS x FROM default.foo', required columns: 'id'.

```

when dropping dependency should show warning that it's being used by another materialized view.
when inserting should show which materialized view that causes the error, so we can drop it.

**Does it reproduce on recent release?**

only test with 21.6.5, pretty sure still happened in the latest.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.