fix: include relation title in wildcard describe output#159
Open
devadathanmb wants to merge 4 commits intodbcli:mainfrom
Open
fix: include relation title in wildcard describe output#159devadathanmb wants to merge 4 commits intodbcli:mainfrom
devadathanmb wants to merge 4 commits intodbcli:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Restores per-relation context in \d / \d+ output by returning a descriptive title (relation kind + qualified name) for each described relation, making wildcard (\d pattern) results unambiguous.
Changes:
- Add relkind→display-name mapping and return a non-
Nonetitle fromdescribe_one_table_details(). - Update
\d/\d+describe-detail tests to assert the new titles. - Add an Unreleased changelog entry documenting the fix.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
pgspecial/dbcommands.py |
Generates a per-relation title based on relkind and schema.relation for describe-detail output. |
tests/test_specials.py |
Updates expectations for \d <relation> / \d+ <relation> to include the returned titles. |
changelog.rst |
Documents the behavior change under Unreleased bug fixes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Description
When
\d/\d+is used with a pattern that matches multiple relations, each relation’s detail output should include clear context (relation kind + qualified name). This is consistent with howpsqldisplays describe output, where each relation is prefixed with a descriptive title such asTable "public.tbl1"orView "public.vw1".This change restores that context by returning a descriptive title for each described relation, aligning pgcli’s behavior with
psqland making wildcard describe results unambiguous.I have run the full
pgclitest suite locally with this patch inpgspecialto ensure that nothing breaks after this change.Closes both dbcli/pgcli#1521 and #158
Screenshots
Before (In
pgcli):Notice that the output does not display the relation name or relation kind.

After (In
pgcli):Output now correctly displays fully qualified relation names.
Checklist
changelog.rst.pip install pre-commit && pre-commit install).