v.1.1.54276New Feature

Support for Non-Constant Arguments and Negative Offsets in substring Function

Added support for non-constant arguments and negative offsets in the function substring(str, pos, len).
Added support for non-constant arguments and negative offsets in the substring(str, pos, len) function.

Why it matters

This feature was created to enhance the flexibility of the substring function by allowing dynamic (non-constant) values for position and length parameters, as well as negative offsets. It solves the limitation where only constant arguments were allowed for pos and len, enabling more versatile string extraction operations, such as extracting substrings relative to the end of the string. This adds significant value for users by enabling more complex and dynamic string manipulation queries.

How to use it

Use the substring function with variable expressions as arguments for pos and len. Negative values for pos indicate offset from the end of the string. For example:

SELECT substring('ClickHouse', -5, 3);

This extracts 3 characters starting from the 5th character from the end.