public inbox for [email protected]
help / color / mirror / Atom feedFrom: Tom Lane <[email protected]>
To: Daniel Heath <[email protected]>
Cc: [email protected]
Subject: Re: Prepared statement invalidation
Date: Thu, 15 Apr 2021 20:17:01 -0400
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
"Daniel Heath" <[email protected]> writes:
> I've found that when I add a new column, I sometimes get a spike of errors on the application side due to prepared statement query plans getting invalidated, causing transactions to rollback.
> The error is:
> ERROR: cached plan must not change result type
> Is there a way to make postgres recalculate the query plan instead of failing the transaction when a new column is added?
No. It'd be easy enough to remove that restriction on the server side,
but we're afraid that it would break applications, which probably aren't
expecting the result rowtype of a prepared query to be different from what
they were told (perhaps only milliseconds earlier).
I'd say the short answer is "don't use prepared queries, or if you do,
spell out the columns you want instead of saying SELECT *".
regards, tom lane
> Thanks,
> Daniel Heath
view thread (3+ messages) latest in thread
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: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: Prepared statement invalidation
In-Reply-To: <[email protected]>
* 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