public inbox for pgsql-general@postgresql.org  
help / color / mirror / Atom feed
From: Vladimir Sitnikov <sitnikov.vladimir@gmail.com>
To: Igor Korot <ikorot01@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
Cc: Rob Sargent <robjsargent@gmail.com>
Subject: Re: Double prepare
Date: Sat, 16 May 2026 17:37:38 +0300
Message-ID: <CAB=Je-EG4j-MUGRdQbRVuNNz=eLUa3b-zhi7Zw+seaOY4SdN7w@mail.gmail.com> (raw)
In-Reply-To: <CAB=Je-HxpyNNbn7girF6Mouf4gmzNQN=jdkrM49VwEtT_uFf4w@mail.gmail.com>
References: <1495292.1778939187@sss.pgh.pa.us>
	<02D2D7C5-7932-4030-B65A-4BECB645E9F0@gmail.com>
	<CAB=Je-HxpyNNbn7girF6Mouf4gmzNQN=jdkrM49VwEtT_uFf4w@mail.gmail.com>

A couple more things to keep in mind:
1) The client has to re-prepare statements on "deallocate all", "alter",
"create", "drop", "alter", "set search_path" statements.
The backend does not automatically keep the prepared statement workable
across those calls.
The offending error messages are "ERROR: cached plan must not change result
type", "ERROR: prepared statement "S_2" does not exist"

2) I've an answer regarding "prepared statement lifespan" at
https://stackoverflow.com/questions/32297503/whats-the-life-span-of-a-postgresql-server-side-prepare...
Looking forward to adding more references there. Feel free pinging me in
the comments.

Vladimir


reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-general@postgresql.org
  Cc: sitnikov.vladimir@gmail.com, ikorot01@gmail.com, tgl@sss.pgh.pa.us, pgsql-general@lists.postgresql.org, robjsargent@gmail.com
  Subject: Re: Double prepare
  In-Reply-To: <CAB=Je-EG4j-MUGRdQbRVuNNz=eLUa3b-zhi7Zw+seaOY4SdN7w@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox