Fix PostgreSQL function argument default parsing#132
Merged
DanCardin merged 2 commits intoDanCardin:mainfrom Dec 4, 2025
Merged
Fix PostgreSQL function argument default parsing#132DanCardin merged 2 commits intoDanCardin:mainfrom
DanCardin merged 2 commits intoDanCardin:mainfrom
Conversation
The column pg_proc.proargdefaults when converted with pg_get_expr returns a comma separated string of default values. This list of values then needs to be aligned to the right most input argument. To avoid this complex rearangement, and avoid any potential edge cases where ',' might be in the default value, the function pg_get_function_arg_default is used to check for a default for each argument.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #132 +/- ##
=======================================
Coverage 89.79% 89.80%
=======================================
Files 86 86
Lines 4096 4099 +3
Branches 850 850
=======================================
+ Hits 3678 3681 +3
Misses 338 338
Partials 80 80 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
DanCardin
reviewed
Dec 4, 2025
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.
Problem
When parsing PostgreSQL function defaults,
pg_proc.proargdefaultsconverted withpg_get_expr()returns a single comma-separated string containing all default values, rather than an array.This creates several challenges:
Solution
Instead of parsing and realigning the comma-separated string, this PR uses PostgreSQL's
pg_get_function_arg_default()function to retrieve the default value for each argument individually. This function: