Skip to content

Fix index/constraint column not shown when its name requires quoting (#6481)#10039

Open
dpage wants to merge 1 commit into
pgadmin-org:masterfrom
dpage:fix-6481-index-quoted-col
Open

Fix index/constraint column not shown when its name requires quoting (#6481)#10039
dpage wants to merge 1 commit into
pgadmin-org:masterfrom
dpage:fix-6481-index-quoted-col

Conversation

@dpage

@dpage dpage commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #6481.

When an index (or exclusion constraint) column name requires quoting — e.g. it contains a double quote or other special characters — the column was not shown in the Properties panel, and editing reported it as empty.

Root cause: the is_exp (expression) flag is computed as pg_get_indexdef(...) = a.attname. pg_get_indexdef() returns the SQL-quoted identifier (e.g. "col""x") while a.attname is the raw name (col"x). For any name needing quoting these never match, so a plain column was misclassified as an expression and dropped.

Fix: compare against pg_catalog.quote_ident(a.attname), which yields the same quoted form as pg_get_indexdef() for both normal and special names. Real expression indexes (where attname is NULL) still evaluate as expressions.

Changes

  • indexes/sql/11_plus/column_details.sql, indexes/sql/default/column_details.sql, exclusion_constraint/sql/default/get_constraint_cols.sql
  • Release note (9.16)

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • Documentation

    • Added release notes for pgAdmin 4 version 9.16, including supported database versions and bundled utilities.
  • Bug Fixes

    • Fixed an issue where quoted index and exclusion constraint column names were not displaying correctly in the Properties panel.

@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@dpage, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 7 minutes and 26 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 2d211fe2-3ab1-4233-9167-735ef477e018

📥 Commits

Reviewing files that changed from the base of the PR and between 9e3ce68 and 464cc15.

📒 Files selected for processing (4)
  • docs/en_US/release_notes_9_16.rst
  • web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/exclusion_constraint/sql/default/get_constraint_cols.sql
  • web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/indexes/sql/11_plus/column_details.sql
  • web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/indexes/sql/default/column_details.sql

Walkthrough

This PR fixes issue #6481 by updating SQL templates for index and exclusion constraint column retrieval to compare index definitions against quoted identifier forms instead of raw attribute names, enabling proper display of columns with special characters in the Properties panel.

Changes

Quoted Identifier Fix for Index and Constraint Columns

Layer / File(s) Summary
Release notes for version 9.16
docs/en_US/release_notes.rst, docs/en_US/release_notes_9_16.rst
Added version 9.16 release notes documenting fix for issue #6481 (quoted index/exclusion constraint column names appearing correctly in Properties panel) and listing supported PostgreSQL versions 13–18 with bundled utilities at version 18.2.
SQL template fixes for quoted identifier comparison
web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/exclusion_constraint/sql/default/get_constraint_cols.sql, web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/indexes/sql/11_plus/column_details.sql, web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/indexes/sql/default/column_details.sql
Updated the is_exp CASE expression in each template to compare pg_get_indexdef(...) against the quoted identifier form (pg_catalog.quote_ident(a.attname)) rather than raw column names, ensuring columns with special characters are matched correctly.

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately describes the main fix: addressing the issue where index/constraint columns with quoted names were not displayed in the Properties panel.
Linked Issues check ✅ Passed The PR directly addresses issue #6481 by fixing the SQL logic that was misclassifying quoted indexed columns as expressions, causing them to be omitted from the Properties panel.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing the quoted identifier handling in index and exclusion constraint column queries, with corresponding release notes documentation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@dpage dpage force-pushed the fix-6481-index-quoted-col branch 2 times, most recently from b1b1a54 to ea60e15 Compare June 9, 2026 11:36
…g#6481

The is_exp flag compared pg_get_indexdef() (which returns the SQL-quoted
identifier) directly against a.attname (the raw name). For any column
name needing quoting these differ, so a plain column was wrongly treated
as an expression and not rendered, and validation reported it empty.
Compare against pg_catalog.quote_ident(a.attname) instead, which matches
pg_get_indexdef()'s output for both normal and quoted names; real
expressions (attname NULL) still evaluate as expressions.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@dpage dpage force-pushed the fix-6481-index-quoted-col branch from ea60e15 to 464cc15 Compare June 9, 2026 11:37
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.

The index column is not shown in the Properties dialogue if the column name contains double quotes *

1 participant