select open change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

FUNCTIONS / STRING FUNCTIONS AND OPERATORS

Removes the longest string containing only characters in characters (a space by default) from the start and end of string.

Signatures & examples

btrim ( string text [, characters text ] ) → text
Removes the longest string containing only characters in characters (a space by default) from the start and end of string.
btrim('xyxtrimyyx', 'xyz') → trim
btrim ( bytes bytea, bytesremoved bytea ) → bytea
Removes the longest string containing only bytes appearing in bytesremoved from the start and end of bytes.
btrim('\x1234567890'::bytea, '\x9012'::bytea) → \x345678
Version history 1
  1. PG 12 → 13changed

Definition snapshot: 2026-09-14T13:14:25.684213+00:00@99e6866c · English manual source