Repository navigation
fix(sql): walk into BEGIN;...COMMIT; transaction blocks (#2953) - #1
Merged
Merged
Conversation
…s#2953) tree-sitter-sql wraps a transaction in its own top-level transaction node instead of statement, so the extractor's root dispatch loop never reached it. Every table, view, function, and trigger defined inside a transaction was silently dropped with no error, and any REFERENCES pointing at one of those tables fell back to a sourceless stub instead of the real node. Route the transaction node through the existing generic walk, which already recurses into whatever children it finds.
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 Graphify-Labs#2953 — SQL statements wrapped in BEGIN; ... COMMIT; transaction blocks were silently dropped, with zero nodes extracted and no error surfaced.
Root cause: tree-sitter-sql wraps a transaction block in its own top-level transaction node instead of statement. The extractor's root dispatch loop only walked children of type statement (plus a few special cases like ERROR), so transaction never matched and everything inside — tables, views, functions, triggers — was skipped. Any REFERENCES pointing at one of those tables also fell back to a sourceless stub instead of resolving to the real node, matching the "empty source_file/source_location" symptom described in the issue.
Fix: route transaction through the same generic walk() used everywhere else — it already recurses into whatever children it finds, so no new logic is needed, just letting the node through.
Test plan: