feat: add preference for default View Data row limit#10170
Open
kundansable wants to merge 1 commit into
Open
Conversation
The plain "View Data" shortcut always performs a SELECT * with no LIMIT, which is effectively unusable on large tables since it always tries to fetch every row. "First/Last 100 Rows" already avoid this by hardcoding limit=100, but there was no way to make the default, unqualified "View Data" action bounded. Add a new preference, view_data_default_row_limit (integer, default 0 = unlimited, preserving current behavior), and apply it in GridCommand.__init__ only for the VIEW_ALL_ROWS command type. The existing objectquery.sql template already renders a LIMIT clause only when limit > 0, so a positive preference value takes effect with no template changes. First/Last 100 Rows are unaffected. Fixes pgadmin-org#10104
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughAdds a query tool preference for a default row limit and applies it to the “View/Edit Data - All Rows” command when configured with a positive value. First/Last 100 Rows behavior remains unchanged. ChangesView Data Row Limit
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
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.
Summary
Closes #10104 — adds a preference to cap the row count fetched by the plain "View Data" action, so it's usable on large tables without always doing a full
SELECT *.Root Cause
Not a bug — a missing option. The Object Explorer's unqualified "View Data" shortcut always runs with no
LIMIT, unlike "First 100 Rows" / "Last 100 Rows", which hardcodelimit=100. On a large table, "View Data" always tries to fetch every row, and there was no way to change that default short of manually running a query with aLIMIT.Fix
Add a new preference
view_data_default_row_limit(integer, default0= unlimited, preserving current behavior) under the sqleditor module's Options category. InGridCommand.__init__, whencmd_type == VIEW_ALL_ROWS, read this preference and setself.limitto it if positive. The existingobjectquery.sqltemplate already renders aLIMITclause only whenlimit > 0, so no template changes are needed. "First/Last 100 Rows" are untouched — they keep their own hardcoded limit.Test Steps
0.0, right-click a table → View/Edit Data → View Data. Confirm behavior is unchanged (noLIMITapplied) from before this change.50, then View Data on a table with more than 50 rows. Confirm exactly 50 rows load.0and confirm "View Data" returns to unlimited.Summary by CodeRabbit