Re: Support prepared statement invalidation when result types change

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jelte Fennema <me(at)jeltef(dot)nl>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Support prepared statement invalidation when result types change
Date: 2024-07-24 15:39:56
Message-ID: 1238027.1721835596@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Jelte Fennema <me(at)jeltef(dot)nl> writes:
> The cached plan for a prepared statements can get invalidated when DDL
> changes the tables used in the query, or when search_path changes.
> ...
> However, we would throw an error if the the result of the query is of a
> different type than it was before:
> ERROR: cached plan must not change result type

Yes, this is intentional.

> This patch starts to allow a prepared statement to continue to work even
> when the result type changes.

What this is is a wire protocol break. What if the client has
previously done a Describe Statement on the prepared statement?
We have no mechanism for notifying it that that information is
now falsified. The error is thrown to prevent us from getting
into a situation where we'd need to do that.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2024-07-24 15:43:43 Re: Slow catchup of 2PC (twophase) transactions on replica in LR
Previous Message Peter Eisentraut 2024-07-24 15:39:00 Re: Detect buffer underflow in get_th()