Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vWqOe-00AdJy-1t for pgsql-general@arkaria.postgresql.org; Sat, 20 Dec 2025 06:24:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vWqOb-009koH-2v for pgsql-general@arkaria.postgresql.org; Sat, 20 Dec 2025 06:24:54 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vWqOb-009ko9-1h for pgsql-general@lists.postgresql.org; Sat, 20 Dec 2025 06:24:54 +0000 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vWqOa-001ck9-0B for pgsql-general@lists.postgresql.org; Sat, 20 Dec 2025 06:24:53 +0000 Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-430f57cd471so1361614f8f.0 for ; Fri, 19 Dec 2025 22:24:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1766211889; x=1766816689; darn=lists.postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:from:to:cc:subject:date :message-id:reply-to; bh=FbePOExHvTwvTyBdiM1RaBjSepJqMBzkHRDUnWXknWs=; b=R+5/55Bn/b4jY/GF/uJ+AzQl852UmqTGdeOHUSnZZ+3qbae4GXglteonbl3F1n09q7 /OIvFT5vOPFDNy+GEWrNXj8x4Dox7344FUBJixob4NAXdvQqP5reIM449Bp+SN4tRbok zQ7qbyRAYGZLBHv5cWaTzeLeDuw91DIYCFfmBrSGRHkpK9n1Jadg4YxvdZzXDKHKRTw4 4eBvH3NwernFkPWDQEVotfCF//rQR0PeI8DmAHhIpNvthCpjyz0bN1ilPBrPpmXeBT0v NJo38dAKM4kMgsTggruQbNZpqmRu6hKZn0q11ToKhx1Lzi92GxsD4dcrXlC6urW5yCck OviA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766211889; x=1766816689; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=FbePOExHvTwvTyBdiM1RaBjSepJqMBzkHRDUnWXknWs=; b=E3CLn89ridUO57fTiGXf6SbIVXqTx6w1gMtx/dOsyceN8JVVgMLUgc4QrWLa+b2fXb 77MAPtebzIAgappR7Yk4OKEa/4idzCR3/TQSJ9/o61Ky3hCZcOY/6sntwtPDiljpGzdL E01h1/FyQCIqywkxA0S8IG5HzspnzKcBNUULPq0laVzoJF4Juy8qr9gmpP/46zwGqhO7 nUlgvBjK2hxberC6jKUCr5t8ms15OGor9VJkp1iQFl3Kj3uQB5elvppnc8poKwRIdN1C uhkcSw/1BWbp3Xyvif62EgPTrH4rHbikgxiSWz3x9rJG1YGb1XH4tlMa1Y/73ZzFgsnn xbIw== X-Forwarded-Encrypted: i=1; AJvYcCXbJtpdPqHh8CpixIS1ADVJkpm/fpV8iwsH7HlINLvHlRSHLHah3d/CptFxwFCNgntPf7E3SqzQfPi9IVis@lists.postgresql.org X-Gm-Message-State: AOJu0Yyv4qZoxvkSQ8r10EoYOxVH2gzI4pMr+r+XxkZm96M+Vdg08+ht fxensGRNIT51+qEQMHd+kzIKqJoOlhRrXA5snoYvw/CPE3JTKw8M99xdRx7bGA9opwQ= X-Gm-Gg: AY/fxX6xij251ygMJ+bAmsr8PEcKcC3KTf6e7eUFY6MzxWM9Wzeu2JZFYdQptADTf/x djFIUzRh4ujdoe20Ek66q6vx2czDH4t9SLhXOpybrLszfojzb9l98zztDa3mxWrKxdLE7PvR2fF 0cz3nLRb33Q4H/yNGMpmoIAiRxf/JZO96EI3BrtRVFGNbHT5hhAn6kdaxBSbpXZ1L9JYcqHmWH8 JcYxDxJSQxaxohET/6yww9Eip8EhfSG6CcochIIvb1fBhLIIoJSmsfuvdsuxGLcZQPPmJm11rZt hK74ga0H/qykkqRJEo/dWsByqcky05tVMueEuzAsrknGrAHGW+HkODNko0nrmx7bln/3M1hTKKf njqN7LqKwcIwOWbRqq2PvPDH+hmCdlB8C9d8teWXnXphtkE568g892lH76oHpf0/J8xzhmIN+c6 wyV+f6/QVW+2U1Qa8Zobuuh6pa49Bf6/FEIJSbCn/4yZ9AwayRJYJieQ== X-Google-Smtp-Source: AGHT+IGxThDtdzwjGuP9JdgujV5BV9xjvxg42Ol+MmZ488L1UNkCxqDgGf3zBzf2EJZRmjKi4cdvpQ== X-Received: by 2002:a05:6000:2907:b0:429:b751:7935 with SMTP id ffacd0b85a97d-4324e704a80mr5946765f8f.56.1766211888917; Fri, 19 Dec 2025 22:24:48 -0800 (PST) Received: from laurenz.albe-K4N0CV00F97414D ([2001:871:270:4cf9:1875:33eb:6694:f468]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4324ea1af20sm8257352f8f.2.2025.12.19.22.24.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Dec 2025 22:24:48 -0800 (PST) Message-ID: <852dee881b6cc82b9d4b51d69d48c415e2a87b4d.camel@cybertec.at> Subject: Re: PQexecPrepared() question From: Laurenz Albe To: Igor Korot , "pgsql-generallists.postgresql.org" Date: Sat, 20 Dec 2025 07:24:47 +0100 In-Reply-To: References: <2547700.1765940917@sss.pgh.pa.us> <9a0ce31a49f149d8d982d2b359095560655f781e.camel@cybertec.at> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.56.2 (3.56.2-2.fc42) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, 2025-12-19 at 20:10 -0800, Igor Korot wrote: > > > > What is =E2=80=9Cclientencoding in this case? > > >=20 > > > - if PGCLIENTENCODING is set in the environment of the client executa= ble, that > >=20 > > No it is not. > >=20 > > > - otherwise, if "client_encoding" is set on the server, that >=20 > I just checked the postgres.conf. >=20 > This file does not have any client_encoding. >=20 > > > - otherwise, SQL_ASCII >=20 > Which means that this is an encoding that will be used. You can verify that with the SQL statement "SHOW client_encoding" in your sample program. > But then I don=E2=80=99t understand anything. >=20 > The code I posted above worked fine on SELECT, but INSERT failed. >=20 > If the SQL_ASCII is the encoding used both operations should fail. Or bot= h succeeds. >=20 > Could someone explain what happened? SQL_ASCII as client encoding means that no conversion will take place. Still, the database encoding (I suspect UTF8) will govern what can be store= d in the database. Anything that is not valid UTF-8 will be rejected. A SELECT will never cause an error - the client will just receive data in UTF-8. Yours, Laurenz Albe