Skip to content

Conversation

@e-gineer
Copy link
Contributor

Summary

  • Fix incorrect log message in outer defer (was logging wrong function name)
  • Add comments explaining the nested defer pattern for future maintainers

Details

Bug fix

The outer defer in goFdwBeginForeignScan was incorrectly logging goFdwExplainForeignScan:

// Before (wrong)
log.Printf("[WARN] goFdwExplainForeignScan failed with panic: %v", r)

// After (correct)
log.Printf("[WARN] goFdwBeginForeignScan failed with panic during early init: %v", r)

Documentation

Added comments explaining why nested defers exist:

  • Outer recover: catches panics during early initialization (before inner defer is registered)
  • Inner recover: catches panics during main scan processing

This provides defense-in-depth for panic handling.

Impact

  • Risk: None - No behavioral change
  • Benefit: Correct logging + easier maintenance

Test plan

  • No functional changes to verify

Fixes #623

🤖 Generated with Claude Code

The outer defer in goFdwBeginForeignScan was incorrectly logging
"goFdwExplainForeignScan" - fixed to correct function name.

Added comments explaining the nested defer pattern:
- Outer recover: catches panics during early initialization
- Inner recover: catches panics during main scan processing

This is a documentation-only change with no behavioral impact.

Fixes #623

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.

Clarify nested defer pattern and fix incorrect log message in fdw.go

2 participants