You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Invalidate type cache on schema changes affecting statement result.
It is a logical continuation of the commit 749d857 Previously if a query used a composite type and it has changed then asyncpg raised either IndexError or RuntimeError with no easy way to recover from it. Unlike cases like in the mentioned commit here we can't reprepare and resend the query because we fail at the very end in attempt to create a Record from the response. It means the query is already done at the server's side. Everything we can do in such case is to invalidate caches and mark the failed prepared statement as "closed", it prevents getting it from the connection's statement cache and the next query will be reprepared. After all we have to reraise the exception to the caller. For handling schema changes a new Connection.reload_schema_state() is added. Now this method invalidates internal cached objects after changes in DB's schema. In future it can do more actions to reflect schema changes to internal representation. It is intended for being called from callbacks for NOTIFY generated from EVENT TRIGGERs or for using in migrations. The other change is replacing RuntimeError=>OutdatedSchemaCacheError when types in a composite type are not equal: 1. it is easier to catch; 2. it is easier to parse because now there is the composite type's name appear. It can be considered as affecting compatibility with previous releases.
0 commit comments