Splits string at occurrences of delimiter and returns the n'th field (counting from one), or when n is negative, returns the |n|'th-from-last field.
Signatures & examples
split_part ( string text, delimiter text, n integer ) → text
Splits string at occurrences of delimiter and returns the n'th field (counting from one), or when n is negative, returns the |n|'th-from-last field.split_part('abc~@~def~@~ghi', '~@~', 2) → defsplit_part('abc,def,ghi,jkl', ',', -2) → ghi
Version history 2
- PG 13 → 14changed
- PG 12 → 13changed
Definition snapshot: 2026-09-14T13:14:25.684213+00:00@99e6866c · English manual source