PostgreSQL pg_client_encoding() Function

The PostgreSQL pg_client_encoding() function returns the encoding used by the client.

pg_client_encoding() Syntax

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

pg_client_encoding()

pg_client_encoding() Examples

This example shows how to use the pg_client_encoding() function to get the encoding used by the client.

SELECT pg_client_encoding();
 pg_client_encoding
--------------------
 UTF8

In the psql tool, the return value of the pg_client_encoding() function is the same as the return value of SHOW client_encoding; statement.

SHOW client_encoding;
 client_encoding
-----------------
 UTF8