Fix UDF/procedure argument grid delete (and add) in edit mode - #10333
Fix UDF/procedure argument grid delete (and add) in edit mode#10333dpage wants to merge 1 commit into
Conversation
…t session canDeleteRow for the function/procedure Arguments grid checked whether the whole function was new rather than whether the individual row was new, so once a function was saved the delete icon was disabled for every argument row, including ones added but not yet saved (same bug pattern already fixed for enum values in pgadmin-org#8208). canAdd had the same whole-object gate, hiding the "+" button entirely once a function was saved, so there was no way to add a row in the first place. Pre-existing (already persisted) arguments remain non-deletable, since PostgreSQL has no way to remove an argument from a function via CREATE OR REPLACE. Also fixes _update_arguments_for_get_sql, which only merged the 'changed' key of the arguments diff and silently dropped (or, without a 'changed' key at all, raised a 500) any newly added argument, so a row added via the now-enabled "+" button actually survives into the generated SQL. Closes pgadmin-org#10252
|
Warning Review limit reached
Next review available in: 7 minutes Limit details: You’ve used all 8 included reviews currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits within each organization. For paid Pro and Pro+ reviews, CodeRabbit uses a developer's included PR review attempts over the past 7 days to set the current hourly allowance. At typical activity levels, the full plan allowance applies. Higher sustained activity can lower the allowance until earlier attempts leave the 7-day window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
canDeleteRow(in the Function/Procedure Definition tab) checked whether the whole function was new instead of whether the row was new, so once a function was saved the trash icon was disabled for every argument row, including ones added but not yet saved. This is the same bug pattern already fixed for enumeration type values in Type enumeration delete label missing #8208 (type.ui.js); this PR applies the equivalent fix tofunction.ui.js.canAddhad the same whole-object gate, hiding the "+" button entirely once a function was saved, so there was never a way to add an argument row while editing an existing function in the first place.CREATE OR REPLACE FUNCTION, so only rows added in the current, unsaved edit session can be deleted (mirroring the enum behaviour, where existing labels can't be removed either)._update_arguments_for_get_sqlonly ever merged thechangedkey of the arguments diff sent from the frontend; it silently dropped any newly added argument (or, if there was nochangedkey at all, raised an unhandledKeyError/500). Fixed so a row added via the now-enabled "+" button actually survives into the generatedCREATE OR REPLACE FUNCTIONSQL.Test plan
regression/runtests.py --pkg browser.server_groups.servers.databases.schemas.functions— all 75 tests pass.test_function_get_msql.pythat edits an existing function with anarguments: {"added": [...]}diff and asserts the new argument's name appears in the generated SQL; verified it fails with a 500 against the pre-fix backend code (confirming it actually exercises the bug).yarn run test:js-once(eslint + jest, full suite) — 152 suites / 945 tests pass.pycodestyle --config=.pycodestyleon both modified Python files — clean.canAdd/canDeleteRow/cidmechanics against the equivalent (already-fixed) enum code path to confirm behavioural parity.Closes #10252