ClickHouse / ClickHouse/ClickHouse

To support DEFAULT in INSERT VALUES

Open
#40,111 0 comments 0 reactions 1 assignee Claimed by @CurtizJ View on GitHub
comp-formats external feature
Dominant language
C++
Stars
49.9k
Forks
9k
Avg merge
21h 32m
Merged PRs (30d)
515

Description

**Describe what's wrong**

Inserting multiple rows into the table with `Boolean DEFAULT false` annotation may not work. It depends on order of rows and definition of `true/false` literal

**Does it reproduce on recent release?**

Reproducible at least in 22.3.8.39 (official build)

**How to reproduce**

* Version 22.3.8.39 (official build)
* Using HTTP interface
* Create table with boolean field and DEFAULT value for it:
```
CREATE TABLE test_boolean
(
id Int64,
success Boolean DEFAULT false
) ENGINE = ReplicatedMergeTree('/clickhouse/tables/{shard}/{database}/test_boolean', '{replica}') ORDER BY id
```
* Insert rows:
```
INSERT INTO test_boolean (id, success) VALUES
(1, 1),
(2, DEFAULT)
```

**Expected behavior**

Two rows are inserted - (1, true), (2, false)

**Error message and/or stacktrace**

Code: 47. DB::Exception: Missing columns: 'DEFAULT' while processing query: 'DEFAULT', required columns: 'DEFAULT' 'DEFAULT': While executing ValuesBlockInputFormat. (UNKNOWN_IDENTIFIER) (version 22.3.8.39 (official build))

**Additional context**

Following statements work fine:
```
INSERT INTO test_boolean (id, success) VALUES
(1, DEFAULT),
(2, 1)
```
```
INSERT INTO test_boolean (id, success) VALUES
(1, true),
(2, DEFAULT)
```

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.