Skip to content

Conversation

@pyramation
Copy link
Collaborator

fix(plpgsql-deparser): fix 2 more failing fixtures (189/190 now pass)

Summary

This PR fixes 2 of the 3 remaining failing round-trip test fixtures, bringing the pass rate from 187/190 to 189/190.

Fixes:

  1. Cursor declaration syntax - Output cursor_name CURSOR FOR query instead of cursor_name refcursor CURSOR FOR query (fixes plpgsql_transaction-17.sql)
  2. Label placement - Output block labels before DECLARE section instead of between DECLARE and BEGIN (fixes plpgsql_control-15.sql)
  3. Tagged dollar quote handling - Test utils now properly handle $tag$ delimiters, not just $$
  4. Qualified variable names - Preserve block-qualified references like lbl.a in FOR loops

Remaining failure: plpgsql_varprops-13.sql - nested DECLARE inside FOR loop (variables are hoisted to top-level DECLARE, changing semantics)

Review & Testing Checklist for Human

  • Verify cursor declaration syntax is correct for various cursor types (explicit cursors, bound cursors, etc.)
  • Test labeled blocks with DECLARE sections to ensure labels appear in correct position
  • Check that the skipLabel parameter doesn't affect nested blocks that should still have their own labels

Test Plan

cd packages/plpgsql-deparser
npm test

Verify output shows "Round-trip tested 189 of 190 fixtures (1 known failures skipped)"

Notes

- Fix cursor declaration syntax: output 'cursor_name CURSOR FOR query' instead of
  'cursor_name refcursor CURSOR FOR query' (fixes plpgsql_transaction-17.sql)
- Fix label placement: output label before DECLARE section, not between DECLARE and BEGIN
  (fixes plpgsql_control-15.sql)
- Fix tagged dollar quote handling in test utils: properly match $ delimiters
- Preserve qualified variable names (lbl.a) in FOR loops

Remaining known failure: plpgsql_varprops-13.sql (nested DECLARE inside FOR loop)
@devin-ai-integration
Copy link
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@pyramation pyramation merged commit 5d0c68e into main Jan 7, 2026
18 checks passed
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.

2 participants