Returned INSERT ... VALUES statement.

'non-Nullable' changed to 'not nullable'
This commit is contained in:
Alexey 2021-05-24 15:26:23 +00:00
parent f32b0dc886
commit 715c88e5fa
2 changed files with 7 additions and 5 deletions

View File

@ -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`.

View File

@ -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.