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 1vXPMV-009XwW-1s for pgsql-general@arkaria.postgresql.org; Sun, 21 Dec 2025 19:45:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vXPMU-00CI4n-1M for pgsql-general@arkaria.postgresql.org; Sun, 21 Dec 2025 19:45:03 +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 1vXPMU-00CI4e-0H for pgsql-general@lists.postgresql.org; Sun, 21 Dec 2025 19:45:02 +0000 Received: from mail-yx1-xb130.google.com ([2607:f8b0:4864:20::b130]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vXPMT-001qsT-09 for pgsql-general@lists.postgresql.org; Sun, 21 Dec 2025 19:45:01 +0000 Received: by mail-yx1-xb130.google.com with SMTP id 956f58d0204a3-6447743ce90so2938812d50.2 for ; Sun, 21 Dec 2025 11:45:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1766346299; x=1766951099; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=h7YGQogSov/Z0GFp2sEsolabhrpRAceIItKIRtOJ2bM=; b=RmMFxEKlt95jcoB8GpR12VTZzWLrSDFD9+mpIVZlleHsxxSxNDjEBDVaf+FD8qYUqL P/DQFl5+9U4mQ7i0ed1VK7NYVngtvnTtc14itO6WkualKeg/d76M1tn7IN2zJFQWXSmQ wuq/O6ckffp20HdRgJFFi8vRpcYXrxfNrpjHtTKC7KnN0yZJPny/1JuYuMzyGWxVrzG3 //ZdiPrqc29b6JS4Y6X+ON4/QJmfNWjaAzRiZ+Kn5tTCaglryZGUji5fuAO6lJ6KZZ/m p9FdLfyR6XS4bSvrukHVIKTNKk9EK6WDUFay2U2FGI8WzZd2Rj5Krpb95QMb4Faeedof z4uQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766346299; x=1766951099; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=h7YGQogSov/Z0GFp2sEsolabhrpRAceIItKIRtOJ2bM=; b=LlEedpHZhqxDQV479d6aXmxkFw8vleLxJvI3/rBLTqNQu+gjkJ4rZ59gneKvL/Ts4U E6/1S1VOMQ3L61KVi3lLfyPznAxc9Zn7wULbiSds87VJHFMTGvi0Fhw1vd4CF2O1qbFA h/Q4ZkfUhXSyFGQ+4ASd0AzvPbzezEklT1Z5gR5ksFksnC13YJzhHmifKFZFPL3j1Xjw PSCNe/G9rLixHvfvMOsGgOWiFKCZJciq68TON1lcOvQPKrh5t+PcaxzfWZ9CPTWbAeSW t7zNseUfI+UuDDHVU/JeENFavMhCHhmSyUXby3O++wPF8TVBqdIvTLKmDeY+f6W1DlKb +brA== X-Forwarded-Encrypted: i=1; AJvYcCUWVYpkA/hHAjskyJvJxep9OxVFi+ktWJ6i8GG9A+YVh7UB/AcEYOPIyfEHm9xm4qtp79+RDR7W89nDm7CZ@lists.postgresql.org X-Gm-Message-State: AOJu0YyTglwDtSwwAMyn3SY54lc7Eu32WSft4iz93y+p8JtAa8JArjlR yRDQEwNaR9ffBVv8XjwdJI02TpDJzdwYveVypITUflWhwgXoi7Al6xuwTLodOvrUgASchDlyt/L 7kF+j3lVGHtDdFfo5S969B/qQBM0St4o= X-Gm-Gg: AY/fxX7frEKVbdh0KNFB3UNXI6XPntBRoul1ryLIvdY5ZIeheC6NvVE14ejIF6XVNck Ke/1ELud4v8x0mIbPvLv7GBVweWjzAqvOg9ehf7SO0D1RPjD4NMDtYlVRh/J6RXO0wrU5rE0zWF qf6fQAogQqWH3FBGwq5LOhiH0EPM09okPiE/Bws/ZgIJafdQ8jVI8Tx6Vv4HNEQzSRcSQa5Y9i1 tNTB8e+FosUIUJe7f2H9suNPpL+NHPCQ79dl/kWqSAkP064e5pBrRwGRrjPJjSUdZNxnGEB+cYy dFSxT/f40LMyXJCIQCb+701YnQF+IofKL8fk/Q== X-Google-Smtp-Source: AGHT+IEFP/9Npp5ONzhM4kVc2QoIQns9RdjxgRGt3KflaOLxmTAmQFRlu6jTT+Y+nykEwjYn+4AadmkVaIaU6MmS1t4= X-Received: by 2002:a05:690e:130d:b0:63f:ab4c:9603 with SMTP id 956f58d0204a3-6466a8a5c6emr6770708d50.45.1766346299325; Sun, 21 Dec 2025 11:44:59 -0800 (PST) MIME-Version: 1.0 References: <2547700.1765940917@sss.pgh.pa.us> <9a0ce31a49f149d8d982d2b359095560655f781e.camel@cybertec.at> <699b6649-6841-48a7-8182-b92d28a70ff7@aklaver.com> <138367.1766337436@sss.pgh.pa.us> In-Reply-To: <138367.1766337436@sss.pgh.pa.us> From: Igor Korot Date: Sun, 21 Dec 2025 11:44:49 -0800 X-Gm-Features: AQt7F2qWd1P4ezq-lUJP30c3fKkCXolNK8PjU9O-yDzlgT62dfLkSNwpZr44mQU Message-ID: Subject: Re: PQexecPrepared() question To: Tom Lane Cc: Adrian Klaver , "David G. Johnston" , Laurenz Albe , "pgsql-generallists.postgresql.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, Tom, On Sun, Dec 21, 2025 at 9:17=E2=80=AFAM Tom Lane wrote: > > Adrian Klaver writes: > > It is not the same setup, in your original question you are hand writin= g > > code not running a script through the ODBC driver. Best bet is the ODBC > > driver is picking up the client(Windows) encoding and passing it to the > > server. > > It might be the other way around. psql absolutely will try to infer > an encoding from its environment, but perhaps the ODBC driver does > not, or does it differently. > > In any case, "SHOW client_encoding" in both the working and > non-working contexts would yield useful information. Adding following code: SQLHSTMT stmt; SQLWCHAR value[25]; ret =3D SQLAllocHandle( SQL_HANDLE_STMT, m_hdbc, &stmt ); ret =3D SQLExecDirect( stmt, L"SHOW client_encoding", SQL_NTS ); ret =3D SQLBindCol( stmt, 1, SQL_C_WCHAR, &value, 25, 0 ); ret =3D SQLFetch( stmt ); ret =3D SQLFreeHandle( SQL_HANDLE_STMT, stmt ); the value of the "value" variable is still "UTF8". Thank you. > > regards, tom lane