Repository navigation
Conversation
TABLE_SCHEMA_CHANGE_ERROR_MESSAGE_PATTERN matched the column counts with \d, a single digit, and String.matches requires a full match. So "bind message has 10 result formats but query has 11 columns" never matched, the stale cached statement was never evicted, and every later execution on the connection failed with the same error until the connection was closed. Postgres reports this error when a proxy such as RDS Proxy parses the named statement again after the schema change, before the client binds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Meemaw <ematej.snuderl@gmail.com>
tsegismont
reviewed
Oct 9, 2026
tsegismont
left a comment
Member
There was a problem hiding this comment.
Thank you @Meemaw , this looks good to me, but it would be great if we could address the regexp compilation concern.
| private PgEncoder encoder; | ||
|
|
||
| private static final String TABLE_SCHEMA_CHANGE_ERROR_MESSAGE_PATTERN = "bind message has \\d result formats but query has \\d columns"; | ||
| private static final String TABLE_SCHEMA_CHANGE_ERROR_MESSAGE_PATTERN = "bind message has \\d+ result formats but query has \\d+ columns"; |
Member
There was a problem hiding this comment.
While we're at it, can you convert this to a compiled pattern?
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1751
TABLE_SCHEMA_CHANGE_ERROR_MESSAGE_PATTERNmatched the column counts with\d, which is a single digit, andString.matchesrequires the whole message to match. Sobind message has 10 result formats but query has 11 columnsnever matched. The stale cached statement was never evicted, and every later execution on the connection failed with the same error until the connection was closed.This changes both counts to
\d+.Test
PreparedStatementCachedTest#testPreparedQueryCacheRefreshOnWideTableSchemaChangeAfterReparseuses a 10-column table and adds an 11th column. Against plain Postgres, a cached statement fails withcached plan must not change result typeinstead, so the test simulates what a proxy such as RDS Proxy does: it re-prepares the statement under the same name withDEALLOCATE/PREPARE. The first execution fails with the 08P01 error, and the next one must succeed.Without the fix, the second execution fails again with
bind message has 10 result formats but query has 11 columns. With it, allPreparedStatement*Testtests pass.