v.22.1Improvement
Short Circuit Evaluation Support for throwIf Function
Short circuit evaluation: support for function throwIf. Closes #32969. #32973 (Maksim Kita).Why it matters
ThethrowIf function allows users to raise exceptions conditionally during query execution. This feature improves query control flow by enabling error throwing only when specific conditions are met, preventing unnecessary evaluations and enhancing debugging and validation within queries.How to use it
Use thethrowIf function within SQL queries to conditionally raise exceptions based on expressions. For example:SELECT throwIf(column = 0, 'Division by zero error')
FROM tableThe function evaluates the condition and throws an error if the condition is true, stopping further execution.