fix(parser): handle IF NOT EXISTS in SQL table references - #838
Open
yzxcj797 wants to merge 1 commit into
Open
Conversation
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.
Pull Request
Linked issue
Closes #820
What & why
_SQL_TABLE_REcurrently captures the literalIFfromCREATE TABLE IF NOT EXISTS .... Because references are deduplicated, later idempotent creates in the same file can then disappear as well.This change:
IF NOT EXISTSclause when extractingCREATE TABLEandCREATE VIEWtargetsIF,NOT, andEXISTSas SQL keywords as a defensive fallbackThe adjacent TEMP/UNLOGGED/MATERIALIZED gaps described in the issue are intentionally left out to keep this PR atomic.
How it was tested
Broader local runs also completed 481 tests in the two touched test modules; the remaining failures were existing Windows path-separator assertions. Whole-project mypy reached an existing Windows-only
SIGKILLerror indaemon_cli.py.AI assistance
OpenAI Codex was used for repository inspection, implementation and test drafting, local verification, and review of the resulting diff.
Checklist
uv run pytest tests/ --tb=short -q(targeted tests pass; full supported-platform suite was not available on Windows)uv run ruff check code_review_graph/uv run mypy code_review_graph/ --ignore-missing-imports --no-strict-optional(the touched parser passes; see existing WindowsSIGKILLfailure above)