Function Reference

LTRIM

Removes the given characters (spaces by default) from the start of a string.

PostgreSQL 17.5
LTRIM(string[, characters])

Parameters

stringtext
Source string
characterstextoptional
Set of characters to remove, a space by default

Return value

A string without the characters from characters at the start; tabs and line breaks are not removed by default

Examples

Removing spaces on the left

PostgreSQL 17.5
SELECT '[' || LTRIM('  Hello  ') || ']' AS trimmed;
trimmed
[Hello ]

Removing leading zeros

PostgreSQL 17.5
SELECT LTRIM('000123', '0');
ltrim
123

Details

characters is a set of single characters, not a substring: LTRIM('xxaxbc', 'xa') removes both x and a and returns bc.

See also