Skip to content

fix(plugin-postgresql): show composite, range and extension-typed columns by their own name instead of ENUM(...) - #2614

Merged
datlechin merged 2 commits into
mainfrom
fix/user-type-column-label
Sep 3, 2026
Merged

fix(plugin-postgresql): show composite, range and extension-typed columns by their own name instead of ENUM(...)#2614
datlechin merged 2 commits into
mainfrom
fix/user-type-column-label

Conversation

@datlechin

Copy link
Copy Markdown
Member

Root cause

information_schema.columns.data_type reports USER-DEFINED for every column whose type is not a built-in: enums, composites, ranges and extension base types alike. PostgresColumnTypeResolver treated that one word as "this is an enum": it looked the type up in the enum label map and, when the lookup missed, labelled the column ENUM(<name>) anyway. So a point3d composite, a floatrange range and an hstore column all showed up in the structure editor as ENUM(point3d), ENUM(floatrange) and ENUM(hstore). This was found as a collateral item while working on #2484.

Fix

  • A USER-DEFINED column with no entry in the enum label map keeps its own type name (point3d, hstore).
  • The enum label query now LEFT JOINs pg_enum and filters on typtype = 'e', so an enum declared with no labels still has a map entry and still resolves to ENUM with an empty value list. Before, that enum was indistinguishable from a composite.
  • fetchEnumLabelMap registers the type even when its label column is NULL.

Evidence

Probed against a throwaway PostgreSQL 17 cluster: information_schema.columns reports USER-DEFINED for point3d (composite), hstore (extension), floatrange (range) and empty_enum (enum with no labels), and the new query lists empty_enum with a NULL label while the old JOIN dropped it.

Tests

PostgresColumnTypeResolverTests: non-enum user types keep their name, a labelless enum still resolves as ENUM, and the label query keeps its LEFT JOIN and typtype filter. The five PostgreSQL column suites pass (14 cases).

Changelog

Fixed: Composite, range and extension-typed PostgreSQL columns labelled ENUM(…) in the structure editor.

https://claude.ai/code/session_014THhVdsUjbCboxNLnQB1dR

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Signed-off-by: Ngô Quốc Đạt <datlechin@gmail.com>
@datlechin
datlechin merged commit ce480eb into main Sep 3, 2026
3 checks passed
@datlechin
datlechin deleted the fix/user-type-column-label branch September 3, 2026 05:29
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.

1 participant