Diagnostic step 1
Before running migrations, plan to drain or recycle connection pools (perform a controlled rolling restart of application instances) so sessions do not hold stale prepared statements.
Generated Oct 3, 2026, 12:35:03 AM
Before running migrations, plan to drain or recycle connection pools (perform a controlled rolling restart of application instances) so sessions do not hold stale prepared statements.
As a hotfix without restarting the app: execute DEALLOCATE ALL or DISCARD ALL in affected sessions to clear server‑side prepared statements. If you cannot run commands in each session, fully recycle the pool as soon as feasible.
Configure the JDBC driver to avoid automatic server‑side prepares (set prepareThreshold to 0 for the PostgreSQL JDBC driver) during deployments that alter parameter types; test this in staging first.
Collect diagnostics for escalation: pg_prepared_statements view output, server logs around the migration, JDBC driver and pool configuration (prepareThreshold, useServerPrepStmts), and a sample stack trace of the error from the application. Share these with the DBA and application engineering teams when requesting a coordinated migration plan.
For long term: adopt safe migration patterns (create new column, backfill, swap, and DROP old column during low traffic or with pool recycle) to avoid in‑place type changes that break prepared statements.