add desc for NULL modifiers

This commit is contained in:
Anna 2020-12-26 15:43:09 +03:00
parent eae916315a
commit 51b76f7367
2 changed files with 19 additions and 0 deletions

View File

@ -2470,4 +2470,15 @@ Possible values:
Default value: `0`.
## data_type_default_nullable {#data_type_default_nullable}
Allows data types without explicit modifiers in table definition will be [Nullable](../../sql-reference/data-types/nullable.md#data_type-nullable).
Possible values:
- 1 — `Nullable`-type expressions are allowed in a table definition.
- 0 — `Nullable`-type expressions are not allowed in a table definition.
Default value: `0`.
[Original article](https://clickhouse.tech/docs/en/operations/settings/settings/) <!-- hide -->

View File

@ -99,6 +99,14 @@ If you add a new column to a table but later change its default expression, the
It is not possible to set default values for elements in nested data structures.
## NULL Or NOT NULL Modifiers
`NULL` and `NOT NULL` modifiers after data type in table definition allow or do not allow it to be [Nullable](../../sql-reference/data-types/nullable.md#data_type-nullable).
If the type is not `Nullable` and if `NULL` is specified, it will be treated as `Nullable`; if `NOT NULL` is specified, then no. For example, `INT NULL` is the same as `Nullable(INT)`. If the type is `Nullable` and `NULL` or `NOT NULL` modifiers are specified, the exception will be thrown.
See also [data_type_default_nullable](../../operations/settings/settings.md#data_type_default_nullable) setting.
## Primary Key {#primary-key}
You can define a [primary key](../../../engines/table-engines/mergetree-family/mergetree.md#primary-keys-and-indexes-in-queries) when creating a table. Primary key can be specified in two ways: