v.23.2Improvement
Insert Null as Default Behavior and Fix for LowCardinality Columns
When insert_null_as_default is enabled and column doesn't have defined default value, the default of column type will be used. Also this PR fixes using default values on nulls in case of LowCardinality columns. #46171 (Kruglov Pavel).Why it matters
This feature solves the problem where insertingNULL into columns without explicitly defined default values could lead to errors or inconsistent behavior. It ensures that such NULL values are automatically replaced with appropriate default values, improving data consistency and simplifying data insertion workflows, especially for LowCardinality columns.How to use it
Enable the feature by setting theinsert_null_as_default parameter to true during insertion. For example:INSERT INTO table_name (column1, column2) VALUES (value1, NULL) SETTINGS insert_null_as_default = 1;This will insert the default value for the column where
NULL is specified if there is no user-defined default value.