-
Notifications
You must be signed in to change notification settings - Fork 879
Fix UDF/procedure argument grid delete (and add) in edit mode #10333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
dpage
wants to merge
2
commits into
pgadmin-org:master
Choose a base branch
from
dpage:fix/issue-10252-udf-argument-delete
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+68
−7
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: pgadmin-org/pgadmin4
Length of output: 239
🏁 Script executed:
Repository: pgadmin-org/pgadmin4
Length of output: 50377
🏁 Script executed:
Repository: pgadmin-org/pgadmin4
Length of output: 50376
🏁 Script executed:
Repository: pgadmin-org/pgadmin4
Length of output: 50377
🌐 Web query:
PostgreSQL CREATE OR REPLACE FUNCTION OUT parameter changed return type input parameter types identity INOUT VARIADIC documentation💡 Result:
In PostgreSQL, the CREATE OR REPLACE FUNCTION command is designed to update an existing function's definition while preserving its identity and external dependencies, such as permissions and ownership [1][2][3]. Because of this, it imposes strict limitations on changes to the function's signature [1][4]. Key limitations when using CREATE OR REPLACE FUNCTION include: Input and Output Parameters: You cannot change the name or data type of existing input parameters [1][5]. If you attempt to do so, PostgreSQL treats the command as an attempt to create a new, distinct function rather than replacing the existing one [1][4]. Similarly, you cannot change the types of any OUT parameters; doing so requires dropping and recreating the function [1][6]. Parameter Names: You are prohibited from changing the names of existing input parameters [1][2]. However, you are permitted to add names to parameters that previously lacked them [1][3]. For functions with multiple OUT parameters, you cannot change the names of the output parameters, as this would alter the column names of the anonymous composite type that defines the function's result [1][4]. Return Type: You cannot change the return type of an existing function using CREATE OR REPLACE FUNCTION [1][5]. This restriction also applies to OUT parameters, which collectively define the return structure [1][6]. When these specific changes are necessary—such as modifying parameter types, changing return types, or altering existing parameter names—the only valid approach is to DROP the existing function and recreate it [1][4][3]. Because dropping a function removes it as a distinct entity, you must also be prepared to drop and recreate any existing database objects (such as views, triggers, or rules) that depend on the original function [4][2][3]. The ALTER FUNCTION command is available for modifying many auxiliary properties of a function, such as ownership, schema, or configuration settings, but it cannot be used to change the fundamental signature (name or argument types) of the function [1][7].
Citations:
🏁 Script executed:
Repository: pgadmin-org/pgadmin4
Length of output: 50376
🏁 Script executed:
Repository: pgadmin-org/pgadmin4
Length of output: 499
Use mode-specific rejection messages for added arguments.
data['arguments']['added']acceptsIN,INOUT,VARIADIC, andOUTrows, but this guard does not inspectargmode. Input modes affect routine identity and can create an overload;OUTrows are excluded from identity and change the return row shape instead. Keep rejecting both cases, but use separate messages and add regression tests for each mode.🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair technical point, and thanks for verifying the OUT-parameter case specifically — an added OUT-only parameter doesn't affect the routine's identity/overload resolution, so PostgreSQL would reject it outright with a distinct 'cannot change return type of existing function' error (SQLSTATE 42P13) rather than silently creating an overload the way an added IN/INOUT/VARIADIC parameter does.
That said, both paths are already safely rejected by the current guard before ever reaching PostgreSQL, so there's no correctness bug here, just an imprecise explanation for the OUT-only sub-case. Splitting the message per argmode and adding a full regression matrix across IN/INOUT/VARIADIC/OUT is more scope than this bug fix (#10252, a delete-icon-does-nothing bug) warrants, so I'm going to leave this open for a maintainer to weigh in on rather than expand scope unilaterally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dpage, agreed. The guard rejects both cases before SQL generation, so this is not a correctness issue for#10252.The only remaining point is that the message is imprecise for an added
OUTargument. Deferring mode-specific messages and their test coverage is reasonable for this PR. I will leave the thread open for maintainer review.✏️ Learnings added
You are interacting with an AI system.