JDBC clients fail with 'bind message supplies 0 parameters' after ALTER COLUMN type; prepared statements misbehave on PostgreSQL 14
Environment
PostgreSQL 14.2 running on Linux (Debian), application server uses PostgreSQL JDBC driver 42.x with HikariCP connection pool; application executes prepared statements extensively and deploys frequent schema migrations that alter column types from INTEGER to BIGINT in production.
Symptoms
After a schema migration that changes a column's data type, Java application immediately starts throwing errors like 'bind message supplies 0 parameters' or 'invalid input syntax for type bigint' for prepared statements that previously worked. Psql clients connected fresh after migration succeed with the same SQL when run manually.
Observations
Errors are transient per client connection: newly opened JDBC connections after a pool restart work fine. The error appears even without a server restart. pg_prepared_statements view shows prepared statements only when application explicitly prepares named statements. Application uses extended query protocol and automatic server‑side prepares. The problem resolves if the connection pool is fully recycled but recurs if the pool remains across schema changes.
Already attempted
Restarting the application server or fully cycling the connection pool resolves the issue temporarily. Attempted to execute DEALLOCATE ALL on active sessions by connecting to each session (not feasible at scale). Did not perform server-side configuration changes without testing.
Question
What mechanism is causing server‑side prepared statements to break after an ALTER COLUMN type, what safe mitigations exist to avoid application errors during rolling migrations, and what diagnostics should be collected before escalating to DBA?
Verified community troubleshooting
No answers yet..
Incident analysis
Most likely causes
Summary
Suggested Fixes
Continue troubleshooting
Related troubles
Matched from the title, description and tags