Subject: Re: PQexecPrepared() question

From: Igor Korot <[email-masked]>
Date: Tue, 16 Dec 2025 21:53:58 -0800

Thx, Tom..

Is there some default value for client_encoding?

Thank you.

On Tue, Dec 16, 2025 at 7:08 PM Tom Lane <[email-masked]> wrote:
>
> Igor Korot <[email-masked]> writes:
> > If I want to have strings (aka char *) as parameters fr the query,
> > should I send UTF-8 strings or something else?
>
> They should be in whatever is selected as the client_encoding
> on your connection.  That goes for query strings too, and whatever
> other text a client might send.
>
>                         regards, tom lane

---

From: Laurenz Albe <[email-masked]>
Date: Wed, 17 Dec 2025 08:32:21 +0100

> Is there some default value for client_encoding?

The default value for a client connection is whatever the parameter
"client_encoding" was set to in the PostgreSQL server configuration.

But that value can be overridden in several ways:

- explicitly by setting "client_encoding" in the connect string

- with the SQL statement SET by the client

- if the client has "client_encoding=auto", by the encoding set in
  the client's environment

- by setting the PGCLIENTENCODING environment variable

Yours,
Laurenz Albe

---

From: Igor Korot <[email-masked]>
Date: Wed, 17 Dec 2025 09:38:38 -0800

Thank you.