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 1vs3zF-003feS-2J for pgsql-general@arkaria.postgresql.org; Mon, 16 Feb 2026 19:10:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vs3zE-004zwq-1O for pgsql-general@arkaria.postgresql.org; Mon, 16 Feb 2026 19:10:24 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vs3zE-004zwg-0C for pgsql-general@lists.postgresql.org; Mon, 16 Feb 2026 19:10:24 +0000 Received: from mail-ej1-x634.google.com ([2a00:1450:4864:20::634]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vs3zB-000000014PE-38gd for pgsql-general@lists.postgresql.org; Mon, 16 Feb 2026 19:10:23 +0000 Received: by mail-ej1-x634.google.com with SMTP id a640c23a62f3a-b8f992167dcso424645166b.1 for ; Mon, 16 Feb 2026 11:10:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1771269020; cv=none; d=google.com; s=arc-20240605; b=L1fic++/ZZIjuEiDABOSn4Dx3KtpClOCLNUEuoJktpNbdhN8APr0HKGJa6lc5RVotA UVIeZ1spE1SH5DHqr9aTOWGyDETnWoxrNn8mSaNB82Cjuwjv6pr2lWZjIXe9yEvpp/Xy dT8lA6wRBEhXa9eSJ24C48X2mcujwCcC3uY/akFPxA4Sjik7ft0UeXTQyBv/Zww34LoP vgmdy60sYOnEMQe03x5oo18qtFZhswX67RhrFkm+9Adrj1IVevPavWzE2B65lAk4uvHS ceXTMLjPcrhenO4syJwPbWhEjSga+nVUAtd0BqxaySzVLFfSuJCekmuC+5brU2ZgZl/m Gu4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=0R0brFOYpAmcPmuOWVBd/kDQ94YJW/cRHMHz7QF5t84=; fh=RFbrF0mTQjBlqpfYYdXHfF5Pse4kYeQx4U0mhRMjtNI=; b=k36E9htFUVQWyv+gSnunViMPca2Hg8oAsQIVr9uv0oMNcp1V775o2N/+rPrAmwt1X8 APnWxx7idz7l/T1UmOE1lYyekqNK/Do1GHYZBwjEvJORos7wqIZqE/LUmyDkeIPMUxAx YkmEo/KLM6jcgC98EgBpKAYoRv/gOrLhTCLAskMt4Zs46pz9F/H4tQhtaBA5mJp2cUty ptiBtL++yTMAkQ6KB9hkRZyxcT2S+3Se4fQBQ9DzwK8gAtda13cD3tZnEOz111deZXmT +QPnlQqvj2IUfxlFjztRSLnl962lFYNMgaTE8Cidsn5cWI1hLTHogpFaDZWNz/M009pU d5AQ==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1771269020; x=1771873820; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=0R0brFOYpAmcPmuOWVBd/kDQ94YJW/cRHMHz7QF5t84=; b=f8tyaiWVnALlAzIF4vCPCkyjbuPPN7H2FGQHFrChoziQXb0uKT4aQx7uiyk9XMbY30 tFpFrp36LRRbNm5+A2MqGE0REI3E0xD8Z/Jg52r1bfxNzJRCHAxIoZRZgsbAOBgQlAWv b8FBkpQl59UnIBrWMy67OzVUTnhwnAA1pU0voCArVMClgYLIEPZUU67ydC8B+YUAU5qO 0S4W3IG/JSkcRjYDXki0BsVW89uq7Lw3IUTrcUvNZET8XYFPXXio5nIPKefKWKmVgB9Y XvdXKEa19bACBTSI1F3Kin/D8mHmB2xPg6TkVi1wBKcA12L6Pa1R3cdNKiUQIT2Mf5ak YVqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771269020; x=1771873820; h=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=0R0brFOYpAmcPmuOWVBd/kDQ94YJW/cRHMHz7QF5t84=; b=DrjAXAVaYTx58/EKf2Qeatxbz9A6ogZhL03P4/pVqgd6LyLiNtvR0RAull6fcZ8RwU Wc9RHUazmbjYqtAFh7ThnrZ0xjhdOsawRbIfTiP3Y83UqlMxu7HriIs8vfmdddbwDjTP uUw5upB97eYK89x8ne5Z5pnUrDHecJBUNnTTp30Q8MxtX3aadPo6QaA8XB81P0q/Y2iy 3uMWyBIKs1XojMULFJ9YnQpCmu1jp9h78IoGS3xGRMOOrQvy5nTbtKMVBZw8r0ubvJnP bMu0ietTefEWj64ZYYMcdTZEhUhrqgkvkwlaWJmR3xXFI9DUf0OaJAM4XAupAPo2vxvY GzBg== X-Gm-Message-State: AOJu0YytabqEgam36YuIp2gHklKmn7DZQ7adUafbrMynR4H9PFIoXMK6 nsKnahaQ352Lw3dHPLB7lbtYpZlIiSdMBLTPthEHpJvLRiPkWhsrAAku2ZBk3oMvrfgvIj0t0QK VEsTPTMcXsJh0f/3x00SlsZqpA28NMm5Ktg== X-Gm-Gg: AZuq6aIYPoXXAn8uhfMsxB/oQFbBg5Ct10eKM38djPFc/PXAGzeNR+nGqeJ+BzT3KTJ 4eofpyQHqb1RKeG215enY4cPbJ9GM3yJjIhgCE8DrHSpXU+z1V/N+zEeQhcdCt1QBcH6u7dBtgH jeCgg5jQB5yKODb9Yg2aeGMGGVGPklByV/6Yf7OdscWvxm6RibqilD25hrB4hV1mRT5kaQC9N4H AeW0i3j3pT5sUdIyfLAxnJPfHpOEzBN/t9yQMBV0DqBfTvhNM0EaoZidgWQJjKUQIDkpT9q2e7t EttJfUA= X-Received: by 2002:a17:907:706:b0:b8f:8ff5:45c with SMTP id a640c23a62f3a-b8fb44bf77emr565392666b.45.1771269019682; Mon, 16 Feb 2026 11:10:19 -0800 (PST) MIME-Version: 1.0 References: <8c5e13fc-43a2-4739-bc87-d1f664cdb6ed@aklaver.com> In-Reply-To: <8c5e13fc-43a2-4739-bc87-d1f664cdb6ed@aklaver.com> From: Durgamahesh Manne Date: Tue, 17 Feb 2026 00:40:08 +0530 X-Gm-Features: AZwV_Qie2Lv8NEr75e0Svic_x6IB12QjP71cMiqlaKDP-HYDXKpA5I526Hs2bZ4 Message-ID: Subject: Re: pgbouncer transaction pool mode issue for prepared statements To: Adrian Klaver Cc: pgsql-general Content-Type: multipart/alternative; boundary="000000000000b849fb064af5b405" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000b849fb064af5b405 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, 16 Feb, 2026, 21:35 Adrian Klaver, wrote: > On 2/16/26 05:24, Durgamahesh Manne wrote: > > Hi PGDG Team > > > > > > > > We=E2=80=99re currently facing an issue with PgBouncer transaction pool= ing mode, > > where prepared statements are failing, and we are unable to modify the > > application code to disable or change how prepared statements are used. > > > > Switching to session pooling mode is not feasible for us because we hav= e > > a very high number of connections that we cannot fully control. > > Environment details: PgBouncer version: 1.25.1 PostgreSQL version: 16.1= 1 > > > > The specific error we=E2=80=99re seeing is: > > > > bind message has 43 result formats but query has 47 columns > > > > ERROR: unnamed prepared statement does not exist Repeatedly logs > > > > Has anyone encountered this issue with transaction pooling and > > prepared statements? Are there any PgBouncer parameters or settings we > > can use to mitigate this problem without requiring application=E2=80=91= level > > changes? Any guidance or solutions would be greatly appreciated. > > A little exploration/searching would have revealed: > > https://www.pgbouncer.org/faq.html > > 5), How to use prepared statements with transaction pooling? > > Which leads to: > > > https://www.pgbouncer.org/faq.html#how-to-use-prepared-statements-with-tr= ansaction-pooling > > which in turn leads to: > > https://www.pgbouncer.org/config.html#max_prepared_statements > > Note though the caveat in last link: > > "Note: This tracking and rewriting of prepared statement commands does > not work for SQL-level prepared statement commands, so PREPARE, EXECUTE > and DEALLOCATE are forwarded straight to Postgres. The exception to this > rule are the DEALLOCATE ALL and DISCARD ALL commands, these do work as > expected and will clear the prepared statements that PgBouncer tracked > for the client that sends this command." > > > > > > Regards > > Durga Mahesh > > > -- > Adrian Klaver > adrian.klaver@aklaver.com Hi Thank you so much for this information Regards Durga Mahesh > > --000000000000b849fb064af5b405 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Mon, 16 Feb, 2026, 21:35 Adri= an Klaver, <adrian.klaver@a= klaver.com> wrote:
On 2/16/= 26 05:24, Durgamahesh Manne wrote:
> Hi PGDG Team
>
>
>
> We=E2=80=99re currently facing an issue with PgBouncer transaction poo= ling mode,
> where prepared statements are failing, and we are unable to modify the=
> application code to disable or change how prepared statements are used= .
>
> Switching to session pooling mode is not feasible for us because we ha= ve
> a very high number of connections that we cannot fully control.
> Environment details: PgBouncer version: 1.25.1 PostgreSQL version: 16.= 11
>
>=C2=A0 =C2=A0The specific error we=E2=80=99re seeing is:
>
> bind message has 43 result formats but query has 47 columns
>
> ERROR: unnamed prepared statement does not exist Repeatedly logs
>
>=C2=A0 =C2=A0Has anyone encountered this issue with transaction pooling= and
> prepared statements? Are there any PgBouncer parameters or settings we=
> can use to mitigate this problem without requiring application=E2=80= =91level
> changes? Any guidance or solutions would be greatly appreciated.

A little exploration/searching would have revealed:

https://www.pgbouncer.org/faq.html

5), How to use prepared statements with transaction pooling?

Which leads to:

https://www.pgbouncer.org/faq.html#how-to-use-prepared-statements-with-tra= nsaction-pooling

which in turn leads to:

https://www.pgbouncer.org/co= nfig.html#max_prepared_statements

Note though the caveat in last link:

"Note: This tracking and rewriting of prepared statement commands does=
not work for SQL-level prepared statement commands, so PREPARE, EXECUTE and DEALLOCATE are forwarded straight to Postgres. The exception to this rule are the DEALLOCATE ALL and DISCARD ALL commands, these do work as
expected and will clear the prepared statements that PgBouncer tracked
for the client that sends this command."


>
> Regards
> Durga Mahesh


--
Adrian Klaver
adrian.klaver@aklaver.com

Hi

Thank you so much for this information=C2=A0

Regards
Durga Mahesh=

--000000000000b849fb064af5b405--