fix: support overloaded functions and procedures in dump (#191)#192
Merged
fix: support overloaded functions and procedures in dump (#191)#192
Conversation
Contributor
There was a problem hiding this comment.
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 toProcedurestruct (matching the existingFunctionimplementation) - 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.
1b41ff3 to
521fee4
Compare
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>
521fee4 to
0a2ef5d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
🤖 Generated with Claude Code