PostgreSQL Function Reference

TRIM
Removes the longest string containing only specified characters from the start, end, or both ends of the string.
PostgreSQL 17.5
TRIM([LEADING | TRAILING | BOTH] [characters] FROM string)
LEADING | TRAILING | BOTH
Specifies from where to remove (BOTH by default).
characters
Characters to remove (space by default).
FROM string
The input string.
Examples
PostgreSQL 17.5
SELECT TRIM(
		BOTH 'x'
		FROM 'xTomx'
	)