unistr()

A function for decoding a string with Unicode escape sequences
This entry relates to a PostgreSQL feature which is part of PostgreSQL 14, due to be released in late 2021.

unistr() is a system function for decoding a string with Unicode escape sequences.

unistr() was added in PostgreSQL 14.

Usage

unistr ( text ) → text

Change history

Examples

Basic usage of unistr():

postgres=# SELECT unistr('\307B\3052');
 unistr 
--------
 ほげ
(1 row)

Execution with an invalid Unicode code point:

postgres=# SELECT unistr('\0000');
ERROR:  invalid Unicode code point: 0000

Execution with an invalid Unicode escape:

postgres=# SELECT unistr('\+10000');
ERROR:  invalid Unicode escape
HINT:  Unicode escapes must be \XXXX, \+XXXXXX, \uXXXX, or \UXXXXXXXX.
  • PostgreSQL 14 documentation: unistr

Categories

Locale and character set handling, System function