Upstream PR: andialbrecht/sqlparse#858
Oracle-style CREATE PROCEDURE ... AS declarations could be split away from the following BEGIN ... END body. That produced invalid statement boundaries for procedural SQL.
A procedure declaration section belongs to the same split statement as its body. PostgreSQL dollar-quoted bodies after AS should not be mistaken for Oracle declarations.
The splitter now keeps Oracle declaration sections in the same statement as the procedure body, with regression coverage for the Oracle case and a PostgreSQL dollar-quoted counterexample.
- Focused regression tests -> 2 passed
tests/test_split.py-> 51 passed- Full test suite -> 489 passed, 2 xfailed, 1 xpassed
ruff check sqlparse/ tests/test_split.py-> passedgit diff --check-> passed