| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Nathan Bossart <nathandbossart(at)gmail(dot)com> |
| Cc: | Jacob Champion <jacob(dot)champion(at)enterprisedb(dot)com>, pgsql-hackers(at)postgresql(dot)org |
| Subject: | Re: alert clients when prepared statements are deallocated |
| Date: | 2026-05-29 17:09:03 |
| Message-ID: | 1689313.1780074543@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Nathan Bossart <nathandbossart(at)gmail(dot)com> writes:
> When trying to take our own advice and teach the frontend LO interface to
> use prepared statements instead of PQfn(), I discovered a couple of
> problems. The biggest problem is that clients aren't alerted when a
> prepared statement is deallocated with DISCARD or DEALLOCATE.
Of course the first question about that is "why doesn't the client
know that already ... didn't it issue the deallocate itself?".
The core answer to that question is that there might be multiple
levels of client code involved, so that while some level of the client
stack probably knows it in some way, other levels might have created
prepared statements and not be aware that they're gone.
Therefore, having the server report this is only a partial answer
to the problem: it will only directly provide a fix to the bottom
client code level. To go further you'd need some inside-the-client
mechanism for propagating the notification up the client stack.
We can't really create that in general, but we can at least make
libpq be a responsible citizen in that chain. In short, a proposed
fix for this must also provide a way for the calling application to
hear about these reports, and a way for it to fall back if they're
not available.
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Bryan Green | 2026-05-29 17:19:33 | Re: Uninitialized memory access in zic |
| Previous Message | Jacob Champion | 2026-05-29 17:07:34 | Re: alert clients when prepared statements are deallocated |