Contents
repeat()
A function for repeating the input string
repeat()
is a system function for generating multiple copies of the input string.
repeat()
was added in PostgreSQL 7.0.
Usage
repeat (string
text
,number
integer
) →text
Change history
- PostgreSQL 7.0
- added (commit a349733b)
Examples
Basic execution example for repeat()
:
postgres=# SELECT repeat('foo', 4); repeat -------------- foofoofoofoo (1 row)
Specifying a zero or negative length returns an empty string:
postgres=# SELECT repeat('foo', 0); repeat -------- (1 row) postgres=# SELECT repeat('foo', -1); repeat -------- (1 row)
References
- PostgreSQL documentation: Other String Functions