mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
disable null_as_default when type is Nullable
This commit is contained in:
parent
6946514c0b
commit
abf26d4935
@ -255,9 +255,15 @@ bool ValuesBlockInputFormat::parseExpression(IColumn & column, size_t column_idx
|
||||
bool found_in_cache = false;
|
||||
const auto & result_type = header.getByPosition(column_idx).type;
|
||||
const char * delimiter = (column_idx + 1 == num_columns) ? ")" : ",";
|
||||
auto structure = templates_cache.getFromCacheOrConstruct(result_type, format_settings.null_as_default,
|
||||
TokenIterator(tokens), token_iterator,
|
||||
ast, *context, &found_in_cache, delimiter);
|
||||
auto structure = templates_cache.getFromCacheOrConstruct(
|
||||
result_type,
|
||||
!result_type->isNullable() && format_settings.null_as_default,
|
||||
TokenIterator(tokens),
|
||||
token_iterator,
|
||||
ast,
|
||||
*context,
|
||||
&found_in_cache,
|
||||
delimiter);
|
||||
templates[column_idx].emplace(structure);
|
||||
if (found_in_cache)
|
||||
++attempts_to_deduce_template_cached[column_idx];
|
||||
|
@ -0,0 +1,2 @@
|
||||
A
|
||||
\N
|
5
tests/queries/0_stateless/01736_null_as_default.sql
Normal file
5
tests/queries/0_stateless/01736_null_as_default.sql
Normal file
@ -0,0 +1,5 @@
|
||||
drop table if exists test_num;
|
||||
create table test_enum (c Nullable(Enum16('A' = 1, 'B' = 2))) engine Log;
|
||||
insert into test_enum values (1), (NULL);
|
||||
select * from test_enum;
|
||||
drop table if exists test_num;
|
Loading…
Reference in New Issue
Block a user