PostgreSQL reverse() Function

The PostgreSQL reverse() function reverses the order of characters in a specified string and return the reversed string.

reverse() Syntax

This is the syntax of the PostgreSQL reverse() function:

reverse(string)

Parameters

string

Required. The string to reverse.

Return value

The PostgreSQL reverse() function returns the specified string with the order of characters reversed.

reverse() Examples

This example shows how to use reverse() to reverse a string:

SELECT reverse('abcdef') AS "reverse('abcdef')";
 reverse('abcdef')
-------------------
 fedcba