v.21.8New Feature

Add Padding Functions: leftPad, rightPad, leftPadUTF8, rightPadUTF8

Add new functions leftPad(), rightPad(), leftPadUTF8(), rightPadUTF8(). #26075 (Vitaly Baranov).
Added new string padding functions leftPad(), rightPad(), leftPadUTF8(), and rightPadUTF8() to ClickHouse.

Why it matters

These functions enable users to pad strings to a specified length, either from the left or right side, supporting both byte and UTF-8 character encodings. This feature helps in formatting output strings consistently, especially when dealing with fixed-width text fields or aligning text data.

How to use it

Use the new functions in your SQL queries by calling them with the syntax: leftPad(string, length, pad_string), rightPad(string, length, pad_string), or their UTF-8 variants leftPadUTF8() and rightPadUTF8() to pad strings from the left or right. Specify the target length and the padding substring as arguments.