select open change scope Open full search

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

FUNCTIONS / BINARY STRING FUNCTIONS AND OPERATORS

Converts a text string (in the database encoding) to a binary string encoded in encoding dest_encoding (see Section 23.3.4 for available conversions).

Signatures & examples

convert_to ( string text, dest_encoding name ) → bytea
Converts a text string (in the database encoding) to a binary string encoded in encoding dest_encoding (see Section 23.3.4 for available conversions).
convert_to('some_text', 'UTF8') → \x736f6d655f74657874
Version history 3
  1. PG 16 → 17changed
  2. PG 13 → 14changed
  3. PG 12 → 13changed

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