Commit 2f88587
fix: Fix PostgreSQL migration 014 CREATE FUNCTION syntax error
This release fixes a critical bug in PostgreSQL migration 014 that was
causing "syntax error at or near 'RETURNS'" errors in production.
## Root Cause
The sqlparser library was dropping empty parentheses `()` from CREATE FUNCTION
statements when reformatting parsed SQL. PostgreSQL requires these parentheses
even when functions have no parameters.
## Key Fixes
### Migration Parser Enhancement
- Enhanced `parse_sql_statements` to detect CREATE FUNCTION statements
- Added automatic restoration of missing parentheses before RETURNS clause
- Fixed syntax: `CREATE FUNCTION name()` instead of `CREATE FUNCTION name`
### Enhanced Test Coverage
- Updated `test_migration_014_sql_parsing` to explicitly verify parentheses preservation
- Added assertions to ensure function names include required parentheses
- Validates complete SQL syntax correctness after sqlparser formatting
### Version Update
- Bumped version to 1.15.3
- Updated CHANGELOG.md with detailed fix description
## Impact
- Migration 014 now executes successfully in production environments
- Resolves CREATE FUNCTION syntax errors in PostgreSQL migrations
- Maintains backward compatibility with existing migration behavior
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>1 parent 75260d8 commit 2f88587
3 files changed
+69
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
10 | 21 | | |
11 | 22 | | |
12 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
22 | 47 | | |
23 | 48 | | |
24 | 49 | | |
| |||
432 | 457 | | |
433 | 458 | | |
434 | 459 | | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
435 | 491 | | |
436 | 492 | | |
437 | 493 | | |
| |||
0 commit comments