v.22.12Improvement

Substitute UDFs in CREATE Query and Use as DEFAULT Expressions

Substitute UDFs in CREATE query to avoid failures during loading at startup. Additionally, UDFs can now be used as DEFAULT expressions for columns. #43539 (Antonio Andelic).
Support substituting User-Defined Functions (UDFs) in CREATE queries to prevent failures during server startup, and enable the use of UDFs as DEFAULT expressions for table columns.

Why it matters

This feature addresses issues where queries using UDFs in CREATE statements could fail during server startup due to unresolved functions. By substituting UDFs appropriately, ClickHouse ensures smooth loading and initialization. Additionally, allowing UDFs as DEFAULT column expressions increases flexibility in defining default values based on custom logic, improving usability and expressiveness.

How to use it

Define User-Defined Functions as usual, and then use them directly within CREATE table queries, including as DEFAULT expressions for columns. ClickHouse will substitute the UDFs during parsing and loading to avoid errors, so no special configuration is required.