v.24.10Improvement

Allow TRIM -ing LEADING or TRAILING empty string as no-op

Allow TRIM -ing LEADING or TRAILING empty string as a no-op. Closes #67792. #68455 (Peter Nguyen).
Allow the TRIM function in ClickHouse to accept LEADING or TRAILING with an empty string as a no-operation.

Why it matters

This feature addresses the issue where using TRIM with LEADING or TRAILING and an empty string caused unexpected behavior. By treating trimming an empty string as a no-op, it prevents errors and aligns behavior with user expectations, improving query stability and usability.

How to use it

Users can simply use the TRIM function with LEADING or TRAILING and specify an empty string as the trim string. For example:

SELECT TRIM(LEADING '' FROM '   example   ');

This will now act as a no-op without error.