Re: Prepared statement invalidation

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Prepared statement invalidation
Дата
Msg-id 3969078.1618532221@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Prepared statement invalidation  ("Daniel Heath" <daniel@heath.cc>)
Ответы Re: Prepared statement invalidation  ("Daniel Heath" <daniel@heath.cc>)
Список pgsql-novice
"Daniel Heath" <daniel@heath.cc> 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
statementquery 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




В списке pgsql-novice по дате отправления:

Предыдущее
От: "Daniel Heath"
Дата:
Сообщение: Prepared statement invalidation
Следующее
От: "Daniel Heath"
Дата:
Сообщение: Re: Prepared statement invalidation