Repository navigation
PG client: evict cached statements on schema change for tables with 10+ columns - #1752
Merged
tsegismont merged 1 commit intoOct 12, 2026
Conversation
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.
Meemaw
force-pushed
the
fix-schema-change-pattern-multi-digit
branch
from
October 12, 2026 10:14
2e09cf3 to
c1729d6
Compare
Member
|
@Meemaw can you make it a single commit and follow the message format for your commit specified here ? https://github.com/eclipse-vertx/vert.x/blob/master/CONTRIBUTING.md#commit-message |
See eclipse-vertx#1751 Motivation: 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. Modifications: Match the column counts with \d+ and precompile the pattern. Add a test that uses a 10-column table, adds an 11th column, and re-prepares the named statement with DEALLOCATE / PREPARE to simulate the proxy. Result: The cached statement is evicted after the first failure, and the next execution succeeds. Assisted-by: Anthropic Claude (claude-opus-5-5) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Meemaw <ematej.snuderl@gmail.com>
Meemaw
force-pushed
the
fix-schema-change-pattern-multi-digit
branch
from
October 12, 2026 12:31
c1729d6 to
942d238
Compare
Contributor
Author
|
@vietj Done: squashed into a single commit and reworded the message to the Motivation / Modifications / Result format. |
Member
|
@Meemaw would you mind sending PRs for |
This was referenced Oct 15, 2026
tsegismont
added a commit
that referenced
this pull request
Oct 15, 2026
…1752) (#1753) See #1751 Motivation: 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. Modifications: Match the column counts with \d+ and precompile the pattern. Add a test that uses a 10-column table, adds an 11th column, and re-prepares the named statement with DEALLOCATE / PREPARE to simulate the proxy. Result: The cached statement is evicted after the first failure, and the next execution succeeds. Assisted-by: Anthropic Claude (claude-opus-5-5) Signed-off-by: Meemaw <ematej.snuderl@gmail.com> Co-authored-by: Matej Šnuderl <ematej.snuderl@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
tsegismont
added a commit
that referenced
this pull request
Oct 15, 2026
…1752) (#1754) See #1751 Motivation: 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. Modifications: Match the column counts with \d+ and precompile the pattern. Add a test that uses a 10-column table, adds an 11th column, and re-prepares the named statement with DEALLOCATE / PREPARE to simulate the proxy. Result: The cached statement is evicted after the first failure, and the next execution succeeds. Assisted-by: Anthropic Claude (claude-opus-5-5) Signed-off-by: Meemaw <ematej.snuderl@gmail.com> Co-authored-by: Matej Šnuderl <ematej.snuderl@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.