v.23.9New Feature
New Type Aliases for DECIMAL in ClickHouse Enhance MySQL Compatibility
Two new type aliasesDECIMAL(P)(as shortcut forDECIMAL(P, 0)andDECIMAL(as shortcut forDECIMAL(10, 0)) were added. This makes ClickHouse more compatible with MySQL's SQL dialect. #53328 (Val Doroshchuk).
Why it matters
This feature solves the inconvenience of specifying scale when using theDECIMAL 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 usingDECIMAL(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 = ...