ClickHouse / ClickHouse/ClickHouse

array() works for .inner_id. matetialized view, but doesn't work in mv with `to db.table` clause

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

Description

### Company or project name

_No response_

### Describe what's wrong

i can define SELECT ... array() as arr without errors for MV without `TO db.table` and got error when use `TO db.table`

### Does it reproduce on the most recent release?

Yes

### How to reproduce

successfull insert data without error
https://fiddle.clickhouse.com/fb3360e0-ec27-4860-b8cf-f0dd463232aa

but failure when add `TO db.table` clause
https://fiddle.clickhouse.com/6ba87860-9c0d-4ab3-af06-64e3b8e72ed8

### Expected behavior

both approach works without error

### Error message and/or stacktrace

```
Received exception from server (version 25.2.2):
Code: 370. DB::Exception: Received from localhost:9000. DB::Exception: Data type Array(Nothing) of column 'items' cannot be used in tables. (DATA_TYPE_CANNOT_BE_USED_IN_TABLES)
(query: CREATE MATERIALIZED VIEW IF NOT EXISTS __test_mv TO __test2 AS
SELECT id,
date,
now() as update,
array() as items
FROM __test1;)
```

### Additional context

_No response_

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.