v.23.9New Feature

New Type Aliases for DECIMAL in ClickHouse Enhance MySQL Compatibility

Two new type aliases DECIMAL(P) (as shortcut for DECIMAL(P, 0) and DECIMAL (as shortcut for DECIMAL(10, 0)) were added. This makes ClickHouse more compatible with MySQL's SQL dialect. #53328 (Val Doroshchuk).
Added two new type aliases DECIMAL(P) and DECIMAL as shortcuts for DECIMAL(P, 0) and DECIMAL(10, 0) respectively, improving compatibility with MySQL's SQL dialect.

Why it matters

This feature solves the inconvenience of specifying scale when using the DECIMAL type in ClickHouse by providing simpler aliases. It enhances SQL dialect compatibility with MySQL, allowing users to write decimal types more naturally and reducing the need for verbose type declarations.

How to use it

Users can now declare decimal columns or variables using DECIMAL(P) to imply a scale of 0 or simply DECIMAL to default to DECIMAL(10, 0) without explicitly specifying scale. For example:

CREATE TABLE example (
val1 DECIMAL(5), -- equivalent to DECIMAL(5, 0)
val2 DECIMAL -- equivalent to DECIMAL(10, 0)
) ENGINE = ...