Skip to content

Keep Oracle procedure declarations in one statement - #895

Closed
RamiNoodle733 wants to merge 2 commits into
andialbrecht:masterfrom
RamiNoodle733:knightwatch-692-oracle-procedure-split
Closed

RamiNoodle733 wants to merge 2 commits into
andialbrecht:masterfrom
RamiNoodle733:knightwatch-692-oracle-procedure-split

Conversation

@RamiNoodle733

@RamiNoodle733 RamiNoodle733 commented Sep 13, 2026

Copy link
Copy Markdown

Summary

Fix sqlparse.split() incorrectly splitting Oracle-style CREATE PROCEDURE ... AS declarations at semicolons that appear before the procedure's BEGIN body.

The splitter now tracks when it is inside a CREATE PROCEDURE, keeps declaration semicolons inside that statement, and clears that state when the procedure's outer END closes. This preserves normal splitting for a statement that follows the completed procedure.

Added focused regression coverage using the maintainer's simplified reproducer from #692, plus a second case confirming a following SELECT is still returned as a separate statement.

Fixes #692

Checklist

  • ran the tests (pytest) - the automation environment cannot check out the repository; the upstream workflow is currently awaiting external approval before jobs can run
  • all style issues addressed (ruff) - not available locally; the upstream workflow is currently awaiting external approval before jobs can run
  • changes are covered by tests
  • documentation is not needed for this parser bug fix

AI assistance was used to inspect the issue and repository guidance and to implement the focused splitter-state change.

Copy link
Copy Markdown
Author

Closing this as a duplicate of the earlier active #858, which addresses the same #692 Oracle procedure-splitting root cause and already includes full local validation. Keeping the older PR avoids overlapping implementations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Split does not work properly

1 participant