Re: cached plan must not change result type

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: James Pang <jamespang886(at)gmail(dot)com>, pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: Re: cached plan must not change result type
Date: 2024-03-29 08:40:14
Message-ID: 60ab210d02748b5da813007ab2504606d0fecaa1.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-jdbc

On Fri, 2024-03-29 at 10:05 +0800, James Pang wrote:
> PGV14, client use PGJDBC driver and prepared statements, when a table
> "alter table alter column type ..." changes done, a lot of JDBC clients
> got this error "cached plan must not change result type".  when a JDBC
> client got this error first time after the DDL schema change, JDBC driver
> will clear this caching-plan and following same SQL statement got parsing
> again and new cached plan right?

Not sure; what do you observe?
Anyway, this is a known problem:
https://jdbc.postgresql.org/documentation/server-prepare/#ddl

> How to avoid this issue when DDL schema changes ?

Don't use server-side prepared statements:
https://jdbc.postgresql.org/documentation/server-prepare/#deactivation
You'll lose some performance though.

Questions like this had better be asked on the pgsql-jdbc list.

Yours,
Laurenz Albe

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message James Pang 2024-03-29 08:56:31 Re: cached plan must not change result type
Previous Message M Sarwar 2024-03-29 03:57:27 Re: Like to RETURN SQL results set

Browse pgsql-jdbc by date

  From Date Subject
Next Message James Pang 2024-03-29 08:56:31 Re: cached plan must not change result type
Previous Message James Pang 2024-03-29 02:05:59 cached plan must not change result type