Repository navigation
fix(postgres): key the analysis cache on casts and function attributes - #103
Merged
Merged
Conversation
The schema fingerprint that keys the .reylo/ cache read user operators but no user cast, and a function's text but not its default arguments, volatility, strictness, kind or variadic argument, all of which decide which call the server makes or what the analysis may assume of it. A change to any of them now moves the fingerprint, so the cached analyses are made again.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
ℹ️ No critical issues. One minor suggestion inline.
Reviewed changes
Reviewed the Postgres schema fingerprint query and its live test at 9f3bf7b.
- Function attributes in the
frow: each user function's row now also includesprokind,provolatile,proisstrict,pronargdefaultsandprovariadic. These are all NOT NULL columns, so no row becomes NULL and drops out ofstring_agg. This covers theprovolatileread incardinality.rs:289. - A new
krow per user cast:pg_castrows withoid >= 16384are now included. This matches the cast condition inTRUST_QUERY(engine/postgres/src/postgres.rs:145), which also filters onoid >= 16384 AND castmethod = 'f'. - Fingerprint test: the test adds five catalog changes.
create or replaceandalter functionkeep the function's oid, so the default, volatility and strictness steps each test their new column directly.
claude-opus-5-5 | 𝕏
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.

The Postgres schema fingerprint, which keys the
.reylo/cache of analyses, missed catalog changes the analysis depends on, so a cached analysis could outlive them:pg_cast): a cast decides which call the server makes (f(x)through an implicit cast,x::tthrough a user's function) and whether the analysis may trust a built-in rule.create cast (boolean as int8) with function …, or recreating itas implicit, left the fingerprint unchanged.create or replace function plus(int, int default 1),alter function … immutableandalter function … strictleft it unchanged.The query now adds a row per user cast and those five attributes to each function's row. Changing the query moves every project's fingerprint once, so each statement is analyzed again on its next build. The fingerprint test gains those five changes; on
mainit fails at the first.