Skip to content

Conversation

@pyramation
Copy link
Collaborator

Summary

Adds a new test fixture for PL/pgSQL trigger functions that demonstrates the deparser's handling of special variables: TG_OP, NEW, OLD, and FOUND. These are PL/pgSQL reserved words that should be output in uppercase without quotes.

The fixture covers common trigger patterns:

  • Checking TG_OP for INSERT/UPDATE/DELETE operations
  • Accessing NEW and OLD record variables
  • Using FOUND to check if a previous statement found rows

Review & Testing Checklist for Human

  • Verify the fixture SQL is valid PL/pgSQL syntax
  • Confirm snapshots show uppercase TG_OP, NEW, OLD, FOUND without quotes (they do)

Notes

This fixture was added as part of work on AST-based procedure generators in constructive-db (PR #319). The snapshots confirm that the pgsql-parser deparser already correctly handles these PL/pgSQL special variables.

Requested by: Dan Lynch (@pyramation)
Link to Devin run: https://app.devin.ai/sessions/6c4e0d41e8d445cebebab85e29243ab2

…LD/TG_OP examples

- Add trigger-function.sql fixture demonstrating PL/pgSQL special variables
- Add trigger-function.sql to pretty test list
- Generate snapshots showing uppercase FOUND/NEW/OLD/TG_OP handling

This fixture tests the deparser's handling of PL/pgSQL special variables
(FOUND, NEW, OLD, TG_OP) which should be output in uppercase without quotes.
@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 b6876cb into main Jan 13, 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