Commit 64c900c
committed
fix(plpgsql-deparser): fix EXCEPTION block handling in deparser
The deparser was not outputting EXCEPTION blocks because it was checking for
block.exceptions.exc_list directly, but the parser wraps the exception block
in a PLpgSQL_exception_block wrapper.
This fix handles both the direct and wrapped formats:
- { exc_list: [...] } (direct)
- { PLpgSQL_exception_block: { exc_list: [...] } } (wrapped)
This resolves 12 of the 15 known failing fixtures:
- All 7 plpgsql_trap-* fixtures
- plpgsql_transaction-19.sql, -20.sql, -21.sql
- plpgsql_control-17.sql
- plpgsql_call-44.sql
Only 3 fixtures remain failing (down from 15):
- plpgsql_varprops-13.sql (nested DECLARE inside FOR loop)
- plpgsql_transaction-17.sql (CURSOR FOR loop with EXCEPTION block)
- plpgsql_control-15.sql (labeled block with EXIT statement)1 parent 9d79484 commit 64c900c
File tree
4 files changed
+39
-15
lines changed- packages/plpgsql-deparser
- __tests__
- __snapshots__
- pretty/__snapshots__
- src
4 files changed
+39
-15
lines changedLines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
190 | 190 | | |
191 | 191 | | |
192 | 192 | | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
193 | 202 | | |
194 | 203 | | |
195 | 204 | | |
| |||
Lines changed: 4 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
40 | 44 | | |
41 | 45 | | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | 46 | | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | 47 | | |
54 | | - | |
55 | | - | |
56 | 48 | | |
57 | 49 | | |
58 | 50 | | |
| |||
Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
166 | 175 | | |
167 | 176 | | |
168 | 177 | | |
| |||
362 | 371 | | |
363 | 372 | | |
364 | 373 | | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
365 | 383 | | |
366 | 384 | | |
367 | 385 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
575 | 575 | | |
576 | 576 | | |
577 | 577 | | |
578 | | - | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
579 | 584 | | |
580 | | - | |
| 585 | + | |
581 | 586 | | |
582 | 587 | | |
583 | | - | |
| 588 | + | |
584 | 589 | | |
585 | 590 | | |
586 | 591 | | |
| |||
0 commit comments