Follow-up from PR #492 (dump --qualify-schema).
--qualify-schema forces full schema qualification for object identifiers (table/view/index/sequence/type/function/procedure/policy names, and ON / REFERENCES / OWNED BY / COMMENT targets). That covers the reserved-word/ambiguity class from #320.
It does not qualify same-schema type references — column types, composite attribute types, function/procedure parameter & return types, aggregate state/transition types, and domain base types. The render-side helper (stripSchemaPrefixMode) can only strip a target-schema prefix; it cannot add one, because the IR stores same-schema user-defined types as bare strings.
Root cause is in the inspector queries (ir/queries/queries.sql), e.g. the column resolved_type CASE emits bare dt.typname when dn.nspname = c.table_schema, and domain base_type uses format_type(...) which is search-path-relative. Cross-schema type references already arrive qualified and are preserved.
Proposed work
- Have the inspector/IR preserve the schema of user-defined types alongside the type name (or always emit a qualified form) for: column types, composite attribute types, domain base types, function/procedure params + returns, aggregate state types.
- Add a render mode that qualifies those type references when
--qualify-schema is set, mirroring the object-identifier behavior.
- Expect broad
testdata fixture churn; gate carefully so default (smart-qualification) output stays byte-identical.
Out of scope
- Free-form expression text (view bodies, policy USING/CHECK, trigger function bodies) — qualifying identifiers inside arbitrary SQL needs real parsing and is intentionally left as-is.
Follow-up from PR #492 (
dump --qualify-schema).--qualify-schemaforces full schema qualification for object identifiers (table/view/index/sequence/type/function/procedure/policy names, andON/REFERENCES/OWNED BY/COMMENTtargets). That covers the reserved-word/ambiguity class from #320.It does not qualify same-schema type references — column types, composite attribute types, function/procedure parameter & return types, aggregate state/transition types, and domain base types. The render-side helper (
stripSchemaPrefixMode) can only strip a target-schema prefix; it cannot add one, because the IR stores same-schema user-defined types as bare strings.Root cause is in the inspector queries (
ir/queries/queries.sql), e.g. the columnresolved_typeCASE emits baredt.typnamewhendn.nspname = c.table_schema, and domainbase_typeusesformat_type(...)which is search-path-relative. Cross-schema type references already arrive qualified and are preserved.Proposed work
--qualify-schemais set, mirroring the object-identifier behavior.testdatafixture churn; gate carefully so default (smart-qualification) output stays byte-identical.Out of scope