v.23.11Improvement

Add Implicit Sign Column Constraint for CollapsingMergeTree Tables

Add a new MergeTree setting add_implicit_sign_column_constraint_for_collapsing_engine (disabled by default). When enabled, it adds an implicit CHECK constraint for CollapsingMergeTree tables that restricts the value of the Sign column to be only -1 or 1. #56701. #56986 (Kevin Mingtarja).
Introduces a new MergeTree setting add_implicit_sign_column_constraint_for_collapsing_engine that, when enabled, adds an implicit CHECK constraint for CollapsingMergeTree tables to ensure the Sign column contains only -1 or 1.

Why it matters

This feature enforces data integrity by restricting the Sign column values in CollapsingMergeTree tables to valid entries (-1 or 1). It helps prevent invalid data that can lead to unexpected query results or engine misbehavior.

How to use it

Enable the setting by specifying add_implicit_sign_column_constraint_for_collapsing_engine = 1 in the MergeTree table settings during table creation or by altering the table settings. By default, this setting is disabled.