From a3640cd7eaf3df2965655423c17e230b73bead42 Mon Sep 17 00:00:00 2001 From: Alexey Date: Sun, 23 May 2021 20:02:17 +0000 Subject: [PATCH 01/14] Description updated --- docs/en/operations/settings/settings.md | 15 ++++++++++++++- docs/en/sql-reference/statements/insert-into.md | 2 ++ docs/en/sql-reference/statements/select/union.md | 6 ++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/docs/en/operations/settings/settings.md b/docs/en/operations/settings/settings.md index b0c879af931..d9555e3e52b 100644 --- a/docs/en/operations/settings/settings.md +++ b/docs/en/operations/settings/settings.md @@ -365,7 +365,20 @@ throws an exception. ## input_format_null_as_default {#settings-input-format-null-as-default} -Enables or disables using default values if input data contain `NULL`, but the data type of the corresponding column in not `Nullable(T)` (for text input formats). +Enables or disables insertion of default values if input data contain `NULL`, but the data type of the corresponding column in not `Nullable(T)` (for text input formats). This setting is applied to `INSERT ... VALUES` queries. + +## insert_null_as_default {#insert_null_as_default} + +Enables the insertion of [default values](../../sql-reference/statements/create/table.md#create-default-values) instead of [NULL](../../sql-reference/syntax.md#null-literal) into non-[Nullable](../../sql-reference/data-types/nullable.md#data_type-nullable) columns. This setting is applied to `INSERT ... SELECT` [queries](../../sql-reference/statements/insert-into.md#insert_query_insert-select). `SELECT` subqueries may be concatenated with `UNION ALL` clause. +If column type is Nullable then `NULL` values are inserted as is. +If column type is non-Nullable and this setting is disabled then inserting `NULL` causes an exception. + +Possible values: + +- 0 — Inserting `NULL` into a non-Nullable column causes an exception. +- 1 — Default column value is inserted instead of `NULL`. + +Default value: `1`. ## input_format_skip_unknown_fields {#settings-input-format-skip-unknown-fields} diff --git a/docs/en/sql-reference/statements/insert-into.md b/docs/en/sql-reference/statements/insert-into.md index 66effcccc3f..59e8a958f48 100644 --- a/docs/en/sql-reference/statements/insert-into.md +++ b/docs/en/sql-reference/statements/insert-into.md @@ -98,6 +98,8 @@ INSERT INTO [db.]table [(c1, c2, c3)] SELECT ... Columns are mapped according to their position in the SELECT clause. However, their names in the SELECT expression and the table for INSERT may differ. If necessary, type casting is performed. +To insert a default value instead of `NULL` into non-Nullable column enable [insert_null_as_default](../../operations/settings/settings.md#insert_null_as_default) setting. + None of the data formats except Values allow setting values to expressions such as `now()`, `1 + 2`, and so on. The Values format allows limited use of expressions, but this is not recommended, because in this case inefficient code is used for their execution. Other queries for modifying data parts are not supported: `UPDATE`, `DELETE`, `REPLACE`, `MERGE`, `UPSERT`, `INSERT UPDATE`. diff --git a/docs/en/sql-reference/statements/select/union.md b/docs/en/sql-reference/statements/select/union.md index cf18ff7a4a2..6cedfb89787 100644 --- a/docs/en/sql-reference/statements/select/union.md +++ b/docs/en/sql-reference/statements/select/union.md @@ -78,4 +78,10 @@ Result: Queries that are parts of `UNION/UNION ALL/UNION DISTINCT` can be run simultaneously, and their results can be mixed together. +**See Also** + +- [insert_null_as_default](../../../operations/settings/settings.md#insert_null_as_default) setting. +- [union_default_mode](../../../operations/settings/settings.md#union-default-mode) setting. + + [Original article](https://clickhouse.tech/docs/en/sql-reference/statements/select/union/) From 97415e931e5dac291ff9f751a7482c5957c5e181 Mon Sep 17 00:00:00 2001 From: lehasm Date: Mon, 24 May 2021 08:12:17 +0300 Subject: [PATCH 02/14] Update docs/en/operations/settings/settings.md Co-authored-by: Kseniia Sumarokova <54203879+kssenii@users.noreply.github.com> --- docs/en/operations/settings/settings.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/operations/settings/settings.md b/docs/en/operations/settings/settings.md index d9555e3e52b..1498876f4e9 100644 --- a/docs/en/operations/settings/settings.md +++ b/docs/en/operations/settings/settings.md @@ -371,7 +371,7 @@ Enables or disables insertion of default values if input data contain `NULL`, bu Enables the insertion of [default values](../../sql-reference/statements/create/table.md#create-default-values) instead of [NULL](../../sql-reference/syntax.md#null-literal) into non-[Nullable](../../sql-reference/data-types/nullable.md#data_type-nullable) columns. This setting is applied to `INSERT ... SELECT` [queries](../../sql-reference/statements/insert-into.md#insert_query_insert-select). `SELECT` subqueries may be concatenated with `UNION ALL` clause. If column type is Nullable then `NULL` values are inserted as is. -If column type is non-Nullable and this setting is disabled then inserting `NULL` causes an exception. +If column type is non-Nullable and this setting is disabled, then inserting `NULL` causes an exception. Possible values: From f32b0dc8861506b56ce2d9d0ebf169d64539a013 Mon Sep 17 00:00:00 2001 From: lehasm Date: Mon, 24 May 2021 08:21:03 +0300 Subject: [PATCH 03/14] Update docs/en/operations/settings/settings.md Co-authored-by: Kseniia Sumarokova <54203879+kssenii@users.noreply.github.com> --- docs/en/operations/settings/settings.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/operations/settings/settings.md b/docs/en/operations/settings/settings.md index 1498876f4e9..32b037eff25 100644 --- a/docs/en/operations/settings/settings.md +++ b/docs/en/operations/settings/settings.md @@ -365,7 +365,7 @@ throws an exception. ## input_format_null_as_default {#settings-input-format-null-as-default} -Enables or disables insertion of default values if input data contain `NULL`, but the data type of the corresponding column in not `Nullable(T)` (for text input formats). This setting is applied to `INSERT ... VALUES` queries. +For text input formats initialize `NULL` fields with default values if data type of this field is not nullable. ## insert_null_as_default {#insert_null_as_default} From 715c88e5faf1ddd14a9130c522f813262cf50708 Mon Sep 17 00:00:00 2001 From: Alexey Date: Mon, 24 May 2021 15:26:23 +0000 Subject: [PATCH 04/14] Returned `INSERT ... VALUES` statement. 'non-Nullable' changed to 'not nullable' --- docs/en/operations/settings/settings.md | 10 ++++++---- docs/en/sql-reference/statements/insert-into.md | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/en/operations/settings/settings.md b/docs/en/operations/settings/settings.md index 32b037eff25..74432811512 100644 --- a/docs/en/operations/settings/settings.md +++ b/docs/en/operations/settings/settings.md @@ -366,16 +366,18 @@ throws an exception. ## input_format_null_as_default {#settings-input-format-null-as-default} For text input formats initialize `NULL` fields with default values if data type of this field is not nullable. +This setting is applied to `INSERT ... VALUES` queries. ## insert_null_as_default {#insert_null_as_default} -Enables the insertion of [default values](../../sql-reference/statements/create/table.md#create-default-values) instead of [NULL](../../sql-reference/syntax.md#null-literal) into non-[Nullable](../../sql-reference/data-types/nullable.md#data_type-nullable) columns. This setting is applied to `INSERT ... SELECT` [queries](../../sql-reference/statements/insert-into.md#insert_query_insert-select). `SELECT` subqueries may be concatenated with `UNION ALL` clause. -If column type is Nullable then `NULL` values are inserted as is. -If column type is non-Nullable and this setting is disabled, then inserting `NULL` causes an exception. +Enables the insertion of [default values](../../sql-reference/statements/create/table.md#create-default-values) instead of [NULL](../../sql-reference/syntax.md#null-literal) into clumns with not [nullable](../../sql-reference/data-types/nullable.md#data_type-nullable) data type. +This setting is applied to `INSERT ... SELECT` [queries](../../sql-reference/statements/insert-into.md#insert_query_insert-select). Note that `SELECT` subqueries may be concatenated with `UNION ALL` clause. +If column type is nullable then `NULL` values are inserted as is regardless of this setting. +If column type is not nullable and this setting is disabled, then inserting `NULL` causes an exception. Possible values: -- 0 — Inserting `NULL` into a non-Nullable column causes an exception. +- 0 — Inserting `NULL` into a not nullable column causes an exception. - 1 — Default column value is inserted instead of `NULL`. Default value: `1`. diff --git a/docs/en/sql-reference/statements/insert-into.md b/docs/en/sql-reference/statements/insert-into.md index 59e8a958f48..a061b83eb04 100644 --- a/docs/en/sql-reference/statements/insert-into.md +++ b/docs/en/sql-reference/statements/insert-into.md @@ -98,7 +98,7 @@ INSERT INTO [db.]table [(c1, c2, c3)] SELECT ... Columns are mapped according to their position in the SELECT clause. However, their names in the SELECT expression and the table for INSERT may differ. If necessary, type casting is performed. -To insert a default value instead of `NULL` into non-Nullable column enable [insert_null_as_default](../../operations/settings/settings.md#insert_null_as_default) setting. +To insert a default value instead of `NULL` into a column with not nullable data type enable [insert_null_as_default](../../operations/settings/settings.md#insert_null_as_default) setting. None of the data formats except Values allow setting values to expressions such as `now()`, `1 + 2`, and so on. The Values format allows limited use of expressions, but this is not recommended, because in this case inefficient code is used for their execution. From aa7d625428c2fe4d451ccda0bb7837003eac7ea8 Mon Sep 17 00:00:00 2001 From: Alexey Date: Mon, 24 May 2021 15:32:55 +0000 Subject: [PATCH 05/14] Description of input_format_null_as_default changed a bit --- docs/en/operations/settings/settings.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/operations/settings/settings.md b/docs/en/operations/settings/settings.md index 74432811512..ca337d39e8e 100644 --- a/docs/en/operations/settings/settings.md +++ b/docs/en/operations/settings/settings.md @@ -365,7 +365,7 @@ throws an exception. ## input_format_null_as_default {#settings-input-format-null-as-default} -For text input formats initialize `NULL` fields with default values if data type of this field is not nullable. +For text input formats initializes `NULL` fields with default values if data type of these fields is not nullable. This setting is applied to `INSERT ... VALUES` queries. ## insert_null_as_default {#insert_null_as_default} From a4dacc4875d152ed6de9c70e970e47df9b3dc33b Mon Sep 17 00:00:00 2001 From: lehasm Date: Tue, 25 May 2021 11:42:29 +0300 Subject: [PATCH 06/14] Update docs/en/operations/settings/settings.md Co-authored-by: olgarev <56617294+olgarev@users.noreply.github.com> --- docs/en/operations/settings/settings.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/operations/settings/settings.md b/docs/en/operations/settings/settings.md index ca337d39e8e..19a34d099de 100644 --- a/docs/en/operations/settings/settings.md +++ b/docs/en/operations/settings/settings.md @@ -370,7 +370,7 @@ This setting is applied to `INSERT ... VALUES` queries. ## insert_null_as_default {#insert_null_as_default} -Enables the insertion of [default values](../../sql-reference/statements/create/table.md#create-default-values) instead of [NULL](../../sql-reference/syntax.md#null-literal) into clumns with not [nullable](../../sql-reference/data-types/nullable.md#data_type-nullable) data type. +Enables or disables the insertion of [default values](../../sql-reference/statements/create/table.md#create-default-values) instead of [NULL](../../sql-reference/syntax.md#null-literal) into columns with not [nullable](../../sql-reference/data-types/nullable.md#data_type-nullable) data type. This setting is applied to `INSERT ... SELECT` [queries](../../sql-reference/statements/insert-into.md#insert_query_insert-select). Note that `SELECT` subqueries may be concatenated with `UNION ALL` clause. If column type is nullable then `NULL` values are inserted as is regardless of this setting. If column type is not nullable and this setting is disabled, then inserting `NULL` causes an exception. From c2cb50f3be69a1aef6ae96b6d89bc60152e73cf9 Mon Sep 17 00:00:00 2001 From: lehasm Date: Tue, 25 May 2021 14:09:55 +0300 Subject: [PATCH 07/14] Update docs/en/operations/settings/settings.md Co-authored-by: olgarev <56617294+olgarev@users.noreply.github.com> --- docs/en/operations/settings/settings.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/operations/settings/settings.md b/docs/en/operations/settings/settings.md index 19a34d099de..ba6bf0c6f1c 100644 --- a/docs/en/operations/settings/settings.md +++ b/docs/en/operations/settings/settings.md @@ -371,7 +371,7 @@ This setting is applied to `INSERT ... VALUES` queries. ## insert_null_as_default {#insert_null_as_default} Enables or disables the insertion of [default values](../../sql-reference/statements/create/table.md#create-default-values) instead of [NULL](../../sql-reference/syntax.md#null-literal) into columns with not [nullable](../../sql-reference/data-types/nullable.md#data_type-nullable) data type. -This setting is applied to `INSERT ... SELECT` [queries](../../sql-reference/statements/insert-into.md#insert_query_insert-select). Note that `SELECT` subqueries may be concatenated with `UNION ALL` clause. +This setting is applicable to [INSERT ... SELECT](../../sql-reference/statements/insert-into.md#insert_query_insert-select) queries. Note that `SELECT` subqueries may be concatenated with `UNION ALL` clause. If column type is nullable then `NULL` values are inserted as is regardless of this setting. If column type is not nullable and this setting is disabled, then inserting `NULL` causes an exception. From 592073ec77788780cfc60c2dc15f8bee4bf64bf8 Mon Sep 17 00:00:00 2001 From: lehasm Date: Tue, 25 May 2021 14:10:05 +0300 Subject: [PATCH 08/14] Update docs/en/operations/settings/settings.md Co-authored-by: olgarev <56617294+olgarev@users.noreply.github.com> --- docs/en/operations/settings/settings.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/operations/settings/settings.md b/docs/en/operations/settings/settings.md index ba6bf0c6f1c..4d92e2cd1eb 100644 --- a/docs/en/operations/settings/settings.md +++ b/docs/en/operations/settings/settings.md @@ -372,7 +372,7 @@ This setting is applied to `INSERT ... VALUES` queries. Enables or disables the insertion of [default values](../../sql-reference/statements/create/table.md#create-default-values) instead of [NULL](../../sql-reference/syntax.md#null-literal) into columns with not [nullable](../../sql-reference/data-types/nullable.md#data_type-nullable) data type. This setting is applicable to [INSERT ... SELECT](../../sql-reference/statements/insert-into.md#insert_query_insert-select) queries. Note that `SELECT` subqueries may be concatenated with `UNION ALL` clause. -If column type is nullable then `NULL` values are inserted as is regardless of this setting. +If column type is nullable then `NULL` values are inserted as is, regardless of this setting. If column type is not nullable and this setting is disabled, then inserting `NULL` causes an exception. Possible values: From 59442ac3d19a0cff2a5e866c0d5171db8806980f Mon Sep 17 00:00:00 2001 From: Alexey Date: Tue, 25 May 2021 17:28:21 +0000 Subject: [PATCH 09/14] input_format_null_as_default description is made similar to insert_null_as_default --- docs/en/operations/settings/settings.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/en/operations/settings/settings.md b/docs/en/operations/settings/settings.md index 4d92e2cd1eb..58f47522ca9 100644 --- a/docs/en/operations/settings/settings.md +++ b/docs/en/operations/settings/settings.md @@ -365,8 +365,8 @@ throws an exception. ## input_format_null_as_default {#settings-input-format-null-as-default} -For text input formats initializes `NULL` fields with default values if data type of these fields is not nullable. -This setting is applied to `INSERT ... VALUES` queries. +Enables or disables the initialization of [NULL](../../sql-reference/syntax.md#null-literal) fields with [default values](../../sql-reference/statements/create/table.md#create-default-values), if data type of these fields is not [nullable](../../sql-reference/data-types/nullable.md#data_type-nullable). +This setting is applicable to `INSERT ... VALUES` queries for text input formats. ## insert_null_as_default {#insert_null_as_default} From 845b33cb1fcf2cd96a64d630e8bcaefc5affe600 Mon Sep 17 00:00:00 2001 From: Alexey Date: Tue, 25 May 2021 18:25:55 +0000 Subject: [PATCH 10/14] Text block moved --- docs/en/sql-reference/statements/insert-into.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/en/sql-reference/statements/insert-into.md b/docs/en/sql-reference/statements/insert-into.md index a061b83eb04..c8b4a9ec9df 100644 --- a/docs/en/sql-reference/statements/insert-into.md +++ b/docs/en/sql-reference/statements/insert-into.md @@ -98,8 +98,6 @@ INSERT INTO [db.]table [(c1, c2, c3)] SELECT ... Columns are mapped according to their position in the SELECT clause. However, their names in the SELECT expression and the table for INSERT may differ. If necessary, type casting is performed. -To insert a default value instead of `NULL` into a column with not nullable data type enable [insert_null_as_default](../../operations/settings/settings.md#insert_null_as_default) setting. - None of the data formats except Values allow setting values to expressions such as `now()`, `1 + 2`, and so on. The Values format allows limited use of expressions, but this is not recommended, because in this case inefficient code is used for their execution. Other queries for modifying data parts are not supported: `UPDATE`, `DELETE`, `REPLACE`, `MERGE`, `UPSERT`, `INSERT UPDATE`. @@ -107,6 +105,8 @@ However, you can delete old data using `ALTER TABLE ... DROP PARTITION`. `FORMAT` clause must be specified in the end of query if `SELECT` clause contains table function [input()](../../sql-reference/table-functions/input.md). +To insert a default value instead of `NULL` into a column with not nullable data type, enable [insert_null_as_default](../../operations/settings/settings.md#insert_null_as_default) setting. + ### Performance Considerations {#performance-considerations} `INSERT` sorts the input data by primary key and splits them into partitions by a partition key. If you insert data into several partitions at once, it can significantly reduce the performance of the `INSERT` query. To avoid this: From b6174884cf9a4bbba0ec8a7869382478b539d271 Mon Sep 17 00:00:00 2001 From: Alexey Date: Tue, 25 May 2021 18:26:12 +0000 Subject: [PATCH 11/14] Russian translation --- docs/ru/operations/settings/settings.md | 17 ++++++++++++++++- docs/ru/sql-reference/statements/insert-into.md | 2 ++ .../ru/sql-reference/statements/select/union.md | 4 ++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/docs/ru/operations/settings/settings.md b/docs/ru/operations/settings/settings.md index 467d27dad32..c724c40c01d 100644 --- a/docs/ru/operations/settings/settings.md +++ b/docs/ru/operations/settings/settings.md @@ -347,7 +347,22 @@ INSERT INTO table_with_enum_column_for_tsv_insert FORMAT TSV 102 2; ## input_format_null_as_default {#settings-input-format-null-as-default} -Включает или отключает использование значений по умолчанию в случаях, когда во входных данных содержится `NULL`, но тип соответствующего столбца не `Nullable(T)` (для текстовых форматов). +Включает или отключает инициализацию [значениями по умолчанию](../../sql-reference/statements/create/table.md#create-default-values) ячеек с [NULL](../../sql-reference/syntax.md#null-literal), если тип данных столбца не позволяет [хранить NULL](../../sql-reference/data-types/nullable.md#data_type-nullable). +Эта настройка используется для запросов `INSERT ... VALUES` для текстовых входных форматов. + +## insert_null_as_default {#insert_null_as_default} + +Включает или отключает вставку [значений по умолчанию](../../sql-reference/statements/create/table.md#create-default-values) вместо [NULL](../../sql-reference/syntax.md#null-literal) в столбцы, которые не позволяют [хранить NULL](../../sql-reference/data-types/nullable.md#data_type-nullable). +Эта настройка используется для запросов [INSERT ... SELECT](../../sql-reference/statements/insert-into.md#insert_query_insert-select). При этом подзапросы `SELECT` могут объединяться с помощью `UNION ALL`. +Если столбец позволяет хранить `NULL`, то значения `NULL` вставляются независимо от этой настройки. +Если столбец не позволяет хранить `NULL` и эта настройка отключена, то вставка `NULL` приведет к возникновению исключения. + +Возможные значения: + +- 0 — вставка `NULL` в столбец, не позволяющий хранить `NULL`, приведет к возникновению исключения. +- 1 — вместо `NULL` вставляется значение столбца по умолчанию. + +Значение по умолчанию: `1`. ## input_format_skip_unknown_fields {#settings-input-format-skip-unknown-fields} diff --git a/docs/ru/sql-reference/statements/insert-into.md b/docs/ru/sql-reference/statements/insert-into.md index bbd330962cf..328f1023624 100644 --- a/docs/ru/sql-reference/statements/insert-into.md +++ b/docs/ru/sql-reference/statements/insert-into.md @@ -107,6 +107,8 @@ INSERT INTO [db.]table [(c1, c2, c3)] SELECT ... Для табличной функции [input()](../table-functions/input.md) после секции `SELECT` должна следовать секция `FORMAT`. +Чтобы вставить значение по умолчанию вместо `NULL` в столбец, который не позволяет хранить `NULL`, включите настройку [insert_null_as_default](../../operations/settings/settings.md#insert_null_as_default). + ### Замечания о производительности {#zamechaniia-o-proizvoditelnosti} `INSERT` сортирует входящие данные по первичному ключу и разбивает их на партиции по ключу партиционирования. Если вы вставляете данные в несколько партиций одновременно, то это может значительно снизить производительность запроса `INSERT`. Чтобы избежать этого: diff --git a/docs/ru/sql-reference/statements/select/union.md b/docs/ru/sql-reference/statements/select/union.md index de8a9b0e4ea..a1e31a0be7f 100644 --- a/docs/ru/sql-reference/statements/select/union.md +++ b/docs/ru/sql-reference/statements/select/union.md @@ -78,3 +78,7 @@ SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 2; Запросы, которые являются частью `UNION/UNION ALL/UNION DISTINCT`, выполняются параллельно, и их результаты могут быть смешаны вместе. +**Смотрите также** + +- Настройка [insert_null_as_default](../../../operations/settings/settings.md#insert_null_as_default). +- Настройка [union_default_mode](../../../operations/settings/settings.md#union-default-mode). From f1b98e69287bf156237c772a2eb10d5bc5c2b585 Mon Sep 17 00:00:00 2001 From: lehasm Date: Wed, 26 May 2021 09:44:09 +0300 Subject: [PATCH 12/14] Update docs/en/operations/settings/settings.md Co-authored-by: olgarev <56617294+olgarev@users.noreply.github.com> --- docs/en/operations/settings/settings.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/operations/settings/settings.md b/docs/en/operations/settings/settings.md index 58f47522ca9..513403cd387 100644 --- a/docs/en/operations/settings/settings.md +++ b/docs/en/operations/settings/settings.md @@ -366,7 +366,7 @@ throws an exception. ## input_format_null_as_default {#settings-input-format-null-as-default} Enables or disables the initialization of [NULL](../../sql-reference/syntax.md#null-literal) fields with [default values](../../sql-reference/statements/create/table.md#create-default-values), if data type of these fields is not [nullable](../../sql-reference/data-types/nullable.md#data_type-nullable). -This setting is applicable to `INSERT ... VALUES` queries for text input formats. +This setting is applicable to [INSERT ... VALUES](../../sql-reference/statements/insert-into.md) queries for text input formats. ## insert_null_as_default {#insert_null_as_default} From 55807e1a4c72717977b2a3b6ab9980a31126202a Mon Sep 17 00:00:00 2001 From: lehasm Date: Wed, 26 May 2021 09:45:05 +0300 Subject: [PATCH 13/14] Update docs/ru/operations/settings/settings.md Co-authored-by: olgarev <56617294+olgarev@users.noreply.github.com> --- docs/ru/operations/settings/settings.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/ru/operations/settings/settings.md b/docs/ru/operations/settings/settings.md index c724c40c01d..f78f6a246f9 100644 --- a/docs/ru/operations/settings/settings.md +++ b/docs/ru/operations/settings/settings.md @@ -348,7 +348,7 @@ INSERT INTO table_with_enum_column_for_tsv_insert FORMAT TSV 102 2; ## input_format_null_as_default {#settings-input-format-null-as-default} Включает или отключает инициализацию [значениями по умолчанию](../../sql-reference/statements/create/table.md#create-default-values) ячеек с [NULL](../../sql-reference/syntax.md#null-literal), если тип данных столбца не позволяет [хранить NULL](../../sql-reference/data-types/nullable.md#data_type-nullable). -Эта настройка используется для запросов `INSERT ... VALUES` для текстовых входных форматов. +Эта настройка используется для запросов [INSERT ... VALUES](../../sql-reference/statements/insert-into.md) для текстовых входных форматов. ## insert_null_as_default {#insert_null_as_default} From 07aa05887827183816aab453685fcee3c8bd1e85 Mon Sep 17 00:00:00 2001 From: Alexey Date: Wed, 26 May 2021 13:03:46 +0000 Subject: [PATCH 14/14] Description of input_format_null_as_default is extended. Sentences reordered. --- docs/en/operations/settings/settings.md | 13 +++++++++++-- docs/ru/operations/settings/settings.md | 13 +++++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/docs/en/operations/settings/settings.md b/docs/en/operations/settings/settings.md index 513403cd387..a2632a2acf0 100644 --- a/docs/en/operations/settings/settings.md +++ b/docs/en/operations/settings/settings.md @@ -366,14 +366,23 @@ throws an exception. ## input_format_null_as_default {#settings-input-format-null-as-default} Enables or disables the initialization of [NULL](../../sql-reference/syntax.md#null-literal) fields with [default values](../../sql-reference/statements/create/table.md#create-default-values), if data type of these fields is not [nullable](../../sql-reference/data-types/nullable.md#data_type-nullable). +If column type is not nullable and this setting is disabled, then inserting `NULL` causes an exception. If column type is nullable, then `NULL` values are inserted as is, regardless of this setting. + This setting is applicable to [INSERT ... VALUES](../../sql-reference/statements/insert-into.md) queries for text input formats. +Possible values: + +- 0 — Inserting `NULL` into a not nullable column causes an exception. +- 1 — `NULL` fields are initialized with default column values. + +Default value: `1`. + ## insert_null_as_default {#insert_null_as_default} Enables or disables the insertion of [default values](../../sql-reference/statements/create/table.md#create-default-values) instead of [NULL](../../sql-reference/syntax.md#null-literal) into columns with not [nullable](../../sql-reference/data-types/nullable.md#data_type-nullable) data type. +If column type is not nullable and this setting is disabled, then inserting `NULL` causes an exception. If column type is nullable, then `NULL` values are inserted as is, regardless of this setting. + This setting is applicable to [INSERT ... SELECT](../../sql-reference/statements/insert-into.md#insert_query_insert-select) queries. Note that `SELECT` subqueries may be concatenated with `UNION ALL` clause. -If column type is nullable then `NULL` values are inserted as is, regardless of this setting. -If column type is not nullable and this setting is disabled, then inserting `NULL` causes an exception. Possible values: diff --git a/docs/ru/operations/settings/settings.md b/docs/ru/operations/settings/settings.md index f78f6a246f9..105e3cc74ee 100644 --- a/docs/ru/operations/settings/settings.md +++ b/docs/ru/operations/settings/settings.md @@ -348,14 +348,23 @@ INSERT INTO table_with_enum_column_for_tsv_insert FORMAT TSV 102 2; ## input_format_null_as_default {#settings-input-format-null-as-default} Включает или отключает инициализацию [значениями по умолчанию](../../sql-reference/statements/create/table.md#create-default-values) ячеек с [NULL](../../sql-reference/syntax.md#null-literal), если тип данных столбца не позволяет [хранить NULL](../../sql-reference/data-types/nullable.md#data_type-nullable). +Если столбец не позволяет хранить `NULL` и эта настройка отключена, то вставка `NULL` приведет к возникновению исключения. Если столбец позволяет хранить `NULL`, то значения `NULL` вставляются независимо от этой настройки. + Эта настройка используется для запросов [INSERT ... VALUES](../../sql-reference/statements/insert-into.md) для текстовых входных форматов. +Возможные значения: + +- 0 — вставка `NULL` в столбец, не позволяющий хранить `NULL`, приведет к возникновению исключения. +- 1 — ячейки с `NULL` инициализируются значением столбца по умолчанию. + +Значение по умолчанию: `1`. + ## insert_null_as_default {#insert_null_as_default} Включает или отключает вставку [значений по умолчанию](../../sql-reference/statements/create/table.md#create-default-values) вместо [NULL](../../sql-reference/syntax.md#null-literal) в столбцы, которые не позволяют [хранить NULL](../../sql-reference/data-types/nullable.md#data_type-nullable). +Если столбец не позволяет хранить `NULL` и эта настройка отключена, то вставка `NULL` приведет к возникновению исключения. Если столбец позволяет хранить `NULL`, то значения `NULL` вставляются независимо от этой настройки. + Эта настройка используется для запросов [INSERT ... SELECT](../../sql-reference/statements/insert-into.md#insert_query_insert-select). При этом подзапросы `SELECT` могут объединяться с помощью `UNION ALL`. -Если столбец позволяет хранить `NULL`, то значения `NULL` вставляются независимо от этой настройки. -Если столбец не позволяет хранить `NULL` и эта настройка отключена, то вставка `NULL` приведет к возникновению исключения. Возможные значения: