v.24.3Improvement

Add toUInt128OrZero Function and Make Compatibility Aliases Case Insensitive

Add the function toUInt128OrZero, which was missed by mistake (the mistake is related to https://github.com/ClickHouse/ClickHouse/pull/945). The compatibility aliases FROM_UNIXTIME and DATE_FORMAT (they are not ClickHouse-native and only exist for MySQL compatibility) have been made case insensitive, as expected for SQL-compatibility aliases. #61114 (Alexey Milovidov).
Introduced the function toUInt128OrZero to safely convert values to UInt128 type returning zero on failure. Additionally, made the MySQL compatibility aliases FROM_UNIXTIME and DATE_FORMAT case insensitive for better SQL compliance.

Why it matters

The new function toUInt128OrZero addresses the absence of a safe conversion method to UInt128 that returns zero instead of failing, enhancing robustness in data type conversion. Making the MySQL compatibility aliases case insensitive improves SQL compatibility and user experience by aligning with expected SQL behavior.

How to use it

Use toUInt128OrZero like any other conversion function to convert values to UInt128 safely, for example:

SELECT toUInt128OrZero(your_column) FROM your_table;


The aliases FROM_UNIXTIME and DATE_FORMAT now accept any case variations automatically and require no special configuration.