Skip to content

fix: include relation title in wildcard describe output#159

Open
devadathanmb wants to merge 4 commits intodbcli:mainfrom
devadathanmb:fix/describe-relation-info-missing
Open

fix: include relation title in wildcard describe output#159
devadathanmb wants to merge 4 commits intodbcli:mainfrom
devadathanmb:fix/describe-relation-info-missing

Conversation

@devadathanmb
Copy link

@devadathanmb devadathanmb commented Mar 1, 2026

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 how psql displays describe output, where each relation is prefixed with a descriptive title such as Table "public.tbl1" or View "public.vw1".

This change restores that context by returning a descriptive title for each described relation, aligning pgcli’s behavior with psql and making wildcard describe results unambiguous.

I have run the full pgcli test suite locally with this patch in pgspecial to 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.
image

After (In pgcli):

Output now correctly displays fully qualified relation names.

image

Checklist

  • I've added this contribution to the changelog.rst.
  • I installed pre-commit hooks (pip install pre-commit && pre-commit install).
  • Please squash merge this pull request (uncheck if you'd like us to merge as multiple commits)

@devadathanmb devadathanmb marked this pull request as ready for review March 1, 2026 13:31
Copilot AI review requested due to automatic review settings March 1, 2026 13:31
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-None title from describe_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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants