fix(plugin-postgresql): show composite, range and extension-typed columns by their own name instead of ENUM(...) - #2614
Merged
Merged
Conversation
…umns by their own name instead of ENUM(...) Claude-Session: https://claude.ai/code/session_014THhVdsUjbCboxNLnQB1dR
|
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>
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.
Root cause
information_schema.columns.data_typereportsUSER-DEFINEDfor every column whose type is not a built-in: enums, composites, ranges and extension base types alike.PostgresColumnTypeResolvertreated 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 columnENUM(<name>)anyway. So apoint3dcomposite, afloatrangerange and anhstorecolumn all showed up in the structure editor asENUM(point3d),ENUM(floatrange)andENUM(hstore). This was found as a collateral item while working on #2484.Fix
USER-DEFINEDcolumn with no entry in the enum label map keeps its own type name (point3d,hstore).LEFT JOINspg_enumand filters ontyptype = 'e', so an enum declared with no labels still has a map entry and still resolves toENUMwith an empty value list. Before, that enum was indistinguishable from a composite.fetchEnumLabelMapregisters the type even when its label column is NULL.Evidence
Probed against a throwaway PostgreSQL 17 cluster:
information_schema.columnsreportsUSER-DEFINEDforpoint3d(composite),hstore(extension),floatrange(range) andempty_enum(enum with no labels), and the new query listsempty_enumwith a NULL label while the oldJOINdropped it.Tests
PostgresColumnTypeResolverTests: non-enum user types keep their name, a labelless enum still resolves asENUM, and the label query keeps itsLEFT JOINandtyptypefilter. 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