Closed
Description
Bug Report
Prepare statement fail when database schema is updated
Versions
- Driver: 0.8.6-RELEASE
- Database: postgres
- Java: 11
- OS: docker - alpine
Current Behavior
When the database change (exemple column type from VARCHAR(55) to VARCHAR(70)) the existing prepared statement return "cached plan must not change result type"
Stack trace
Error: SEVERITY_LOCALIZED=ERROR, SEVERITY_NON_LOCALIZED=ERROR, CODE=0A000, MESSAGE=cached plan must not change result type, FILE=plancache.c, LINE=716, ROUTINE=RevalidateCachedQuery
Table schema
Input Code
CREATE TABLE public.applied_message (
id varchar(50) NOT NULL,
CONSTRAINT pk_applied_message PRIMARY KEY (id)
);
-- run you application who perform insert into applied_message values ('A')
ALTER TABLE applied_message ALTER COLUMN id TYPE varchar(75) USING id::varchar;
Steps to reproduce
Input Code
// using spring driver to perform request
// run
this.databaseClient
.insert()
.into("applied_message")
.value("id", eventId)
.then()
// update the database id column
// run
this.databaseClient
.insert()
.into("applied_message")
.value("id", eventId)
.then()
// the error Error: SEVERITY_LOCALIZED=ERROR, SEVERITY_NON_LOCALIZED=ERROR, CODE=0A000, MESSAGE=cached plan must not change result type, FILE=plancache.c, LINE=716, ROUTINE=RevalidateCachedQuery will happen
Expected behavior/code
Don't fail and refresh the prepared statement.
I don't know if the refresh should be done by the postgres driver or by spring or if it should be managed by each application.