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 end of string.

Signatures & examples

rtrim ( string text [, characters text ] ) → text
Removes the longest string containing only characters in characters (a space by default) from the end of string.
rtrim('testxxzx', 'xyz') → test
rtrim ( bytes bytea, bytesremoved bytea ) → bytea
Removes the longest string containing only bytes appearing in bytesremoved from the end of bytes.
rtrim('\x1234567890'::bytea, '\x9012'::bytea) → \x12345678
Version history 2
  1. PG 13 → 14changed
  2. PG 12 → 13changed

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