PostgreSQL 18 reference · String Functions

PostgreSQL LTRIM() Function

Remove spaces, or characters you list, from the start of a string only.

PostgreSQL 18

Create a free account to save this page, take notes and track your progress. Sign in

Syntax

ltrim(string, characters)

Parameters

ParameterDescription
string The input text.
characters optional Characters to remove; spaces by default.

Return value

Text.

Examples

Leading spaces
SELECT '[' || ltrim('   left') || ']' AS result;

Output

 result
--------
 [left]
(1 row)

Run this on your computer — see “Get Started” for setup.

Leading characters
SELECT ltrim('xxyHello', 'xy') AS result;

Output

 result
--------
 Hello
(1 row)

Run this on your computer — see “Get Started” for setup.

In other languages

Was this page helpful?