ClickHouse / ClickHouse/ClickHouse

`INSERT VALUES` reports incorrect row count when table has Materialized View

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

Description

### Problem
```sql
CREATE TABLE test(id UInt64, name String) ENGINE = Memory;
CREATE MATERIALIZED VIEW mv ENGINE = Memory AS SELECT id FROM test;
INSERT INTO test VALUES (1,1);
```
> 1 row in set. Elapsed: 0.002 sec.

This should return 2 as row was inserted in table and MV. If we, however, do

```sql
INSERT INTO test SELECT number AS id, toString(number) AS name FROM numbers(1);
```

then we correctly see

> 2 rows in set. Elapsed: 0.002 sec.

### Related
Found when working on https://github.com/ClickHouse/ClickHouse/pull/79462

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.