Fix catalog restoration after failed adapter operations - #6114
Open
lllleolin-max wants to merge 1 commit into
Open
lllleolin-max wants to merge 1 commit into
lllleolin-max wants to merge 1 commit into
Conversation
Signed-off-by: lllleolin-max <244385774+lllleolin-max@users.noreply.github.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.
Description
An operation on an explicitly qualified catalog can leave the adapter using that catalog when the operation raises. A later unqualified statement then runs in the wrong catalog. For example, a failing metadata query for an attached DuckDB catalog currently causes the next unqualified
CREATE TABLEto create its table there instead of in the original catalog.Restore the previous catalog in
finallyaround the temporarily switched operation. Successful return values and the existing paths that require no switch are preserved. When restoration succeeds, the original operation exception propagates unchanged. If restoration itself fails, its exception propagates with the operation error retained as context.The production change is confined to
set_catalog; tests exercise actual DuckDB placement after an error, positional/keyword table and schema arguments, nested operations, unchanged input expressions, and restoration failure.Test Plan
signal.SIGUSR1error, confirmed on baseline. The migration-number script passed under Git Bash; its pre-commit/bin/bashinvocation is unavailable on this Windows host.AI assistance was used for implementation and validation, with a separate independent code review and executable regression checks.
Checklist
make styleand fixed any issuesmake fast-test)git commit -s) per the DCOThe unchecked validation items reflect the baseline environment limitations above; no check configuration was relaxed.