Add support for 'ONLY' predicate in Index creation dialog. #6386#9643
Add support for 'ONLY' predicate in Index creation dialog. #6386#9643RohitBhati8269 wants to merge 1 commit intopgadmin-org:masterfrom
Conversation
WalkthroughIntroduces a new "Only Table?" toggle in the PostgreSQL index creation UI that allows users to create indexes on only the specified table, with corresponding SQL template updates to conditionally include the ONLY modifier in CREATE INDEX statements across PostgreSQL versions 11, 13, and 15+. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. 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 |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/static/js/index.ui.js`:
- Around line 528-535: The indisonly control currently allows being set together
with isconcurrent which produces invalid SQL; update the indisonly field
definition (the disabled callback for indexSchemaObj.node_info) to include deps:
['isconcurrent'] and return true when state.isconcurrent is truthy (preventing
ONLY when CONCURRENTLY is selected), and additionally add a mutual-exclusion
check in the form validate() (or in the index creation validator) to reject the
combination of state.isconcurrent and state.indisonly with a clear validation
error; reference the indisonly field's disabled callback, deps:
['isconcurrent'], state.isconcurrent, and the validate() function to implement
both the UI disable and the validation guard.
- Around line 526-536: The 'indisonly' field in the index field definition is
missing a PostgreSQL version guard; update the field object (id: 'indisonly'
within the index UI schema) to include min_version: 110000 so the switch is only
shown/active for PG >= 11 connections (consistent with other guarded fields like
'deduplicate_items' and 'indnullsnotdistinct'), leaving the existing disabled
and helpMessage logic intact and using indexSchemaObj.node_info for context as
before.
- Line 535: Update the helpMessage for the ONLY option in index.ui.js (the
helpMessage property) to explicitly state that using ONLY creates the index only
on that table and the resulting index is initially marked INVALID; also mention
that the index becomes valid once matching indexes exist on partitions (e.g.,
via ALTER INDEX ... ATTACH PARTITION). Modify the gettext string accordingly so
users know the index won't be usable immediately and how it can be made valid.
...pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/static/js/index.ui.js
Show resolved
Hide resolved
...pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/static/js/index.ui.js
Show resolved
Hide resolved
...pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/static/js/index.ui.js
Show resolved
Hide resolved
5dad6be to
d158209
Compare
Summary by CodeRabbit
Release Notes