↑↓ select ↵ open ⌫ change scope Open full search

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

Functions / String Functions And Operators

Extends the string to length length by prepending the characters fill (a space by default).

Reading PG 18current·documented in 27 of 27 versions, 7.1 to 20

Signatures & examples

lpad ( string text, length integer [, fill text ] ) → text
Extends the string to length length by prepending the characters fill (a space by default). If the string is already longer than length then it is truncated (on the right).
lpad('hi', 5, 'xy') → xyxhi
Version history 3
  1. 12 → 13 changed
  2. 8.0 → 8.1 changed
  3. 7.2 → 7.3 changed

Definition snapshot: b7bd9cda · English manual source