select open change scope Open full search

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

FUNCTIONS / STRING FUNCTIONS AND OPERATORS

string_to_table

Read PG 18 manual ↗

Splits the string at occurrences of delimiter and returns the resulting fields as a set of text rows.

Signatures & examples

string_to_table ( string text, delimiter text [, null_string text ] ) → setof text
Splits the string at occurrences of delimiter and returns the resulting fields as a set of text rows. If delimiter is NULL, each character in the string will become a separate row of the result. If delimiter is an empty string, then the string is treated as a single field. If null_string is supplied and is not NULL, fields matching that string are replaced by NULL.
string_to_table('xx~^~yy~^~zz', '~^~', 'yy') → xx
NULL
zz
Version history 1
  1. PG 13 → 14added

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