Skip to content

Conversation

@tianzhou
Copy link
Contributor

@tianzhou tianzhou commented Dec 5, 2025

Fix #191

Functions and procedures with the same name but different signatures were being overwritten during dump because they were stored using only the name as the map key. Now uses name(arguments) as the key to distinguish overloads.

Changes:

  • Add GetArguments() method to Procedure (matching Function)
  • Use signature-based keys in inspector for functions and procedures
  • Update diff logic to use signature-based keys for procedures
  • Include signature in dump comment headers for functions/procedures
  • Add test case for issue Overloaded Functions Not Fully Dumped #191

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings December 5, 2025 08:29
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes issue #191 where overloaded functions and procedures with the same name but different signatures were being overwritten during dump operations. The fix changes the internal storage keys from using just the function/procedure name to using name(arguments) to uniquely identify each overload.

Key Changes:

  • Added GetArguments() method to Procedure struct (matching the existing Function implementation)
  • Updated inspector to use signature-based keys when storing functions and procedures
  • Modified dump formatter to include signatures in comment headers for disambiguation
  • Updated diff logic to use signature-based keys for procedure comparisons

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
testdata/dump/issue_191_function_procedure_overload/raw.sql Test case with 3 overloaded functions and 3 overloaded procedures
testdata/dump/issue_191_function_procedure_overload/pgschema.sql Expected pgschema dump output showing all 6 overloads preserved
testdata/dump/issue_191_function_procedure_overload/pgdump.sql Expected pg_dump output for comparison
testdata/dump/issue_191_function_procedure_overload/manifest.json Test case metadata documenting the overload scenarios
ir/ir.go Added GetArguments() method to Procedure type for signature extraction
ir/inspector.go Changed function/procedure storage to use name(arguments) as map keys
internal/dump/formatter.go Updated comment headers to include signatures for overloaded functions/procedures
internal/diff/diff.go Modified procedure diff logic to use signature-based keys

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@tianzhou tianzhou force-pushed the overload_function branch 6 times, most recently from 1b41ff3 to 521fee4 Compare December 5, 2025 16:23
Functions and procedures with the same name but different signatures
were being overwritten during dump because they were stored using only
the name as the map key. Now uses name(arguments) as the key to
distinguish overloads.

Changes:
- Add GetArguments() method to Procedure (matching Function)
- Use signature-based keys in inspector for functions and procedures
- Update diff logic comments (keys already include signature from inspector)
- Include signature in dump comment headers for functions/procedures
- Add test case for issue #191
- Regenerate test fingerprints and expected dump outputs affected by new key format

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@tianzhou tianzhou merged commit c37d385 into main Dec 5, 2025
2 checks passed
@tianzhou tianzhou deleted the overload_function branch December 18, 2025 07:24
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.

Overloaded Functions Not Fully Dumped

1 participant