Skip to content

Name an extension used through an array or a domain in the data copy preflight (S-007-7) - #176

Merged
shipmill-romamo[bot] merged 1 commit into
mainfrom
fix/173-preflight-extension-arrays
Oct 30, 2026
Merged

shipmill-romamo[bot] merged 1 commit into
mainfrom
fix/173-preflight-extension-arrays

Conversation

@shipmill-romamo

Copy link
Copy Markdown
Contributor

Summary

Issue #173, item 1. The data copy preflight's needed CTE matched an extension only when a selected object depends directly on one of its members (pg_depend, deptype = 'e'). A citext[] column depends on the array type _citext, and _citext depends on citext with deptype = 'i', not on the extension. So citext was neither reported under extensions (S-007-7) nor passed to pg_dump --extension. The same gap hit a column of a domain over citext when the domain lives outside the selected schemas.

The fix adds a recursive referenced(classid, objid) CTE. It starts from every object a selected object depends on, then walks each type to its array element type (typcategory = 'A', typelem) and to its domain base type (typtype = 'd', typbasetype), chained. Only then does it match extension members. This is still the one query that feeds both the extensions finding and the --extension list; it only gains WITH RECURSIVE. Names still arrive only as psql variables, and the shape of the finding lists is unchanged.

Out of scope, moved to #175: extensions installed in an unselected schema, and auth. references in foreign keys, defaults and views.

Plan

  • Serves: quality bar
  • Files: engine/ansible/roles/cloudfall_data_migration/defaults/main.yml, engine/tests/test_data_migration_role.py, changelog.d/173-preflight-extension-arrays.md
  • Order: the failing test first (a citext[] column and a domain over citext must name citext), then the needed CTE follows array element and domain base types before matching extension members
  • Proof: test_s007_7_an_array_or_domain_of_an_extension_type_names_it fails on main and passes after (S-007-7); ruff, mypy, ansible-lint and the touched test files pass

Test notes

  • New test_s007_7_an_array_or_domain_of_an_extension_type_names_it (rendered SQL): fails on main, passes here

  • uv run pytest engine/tests/test_data_migration_role.py sdk/tests/test_data_copy_preflight.py: 28 passed

  • uv run ruff check ., uv run mypy, and ANSIBLE_CONFIG=engine/ansible/ansible.cfg uv run ansible-lint engine/ansible (as CI runs it) all pass

  • Live check, outside the suite: I ran both main's query and this branch's query on a throwaway PostgreSQL 16.2 (the pgserver wheel), with schema app selected and the extension installed in an unselected schema. That build has no contrib, so pgvector's vector stood in for citext; it has the same shape, an extension base type with an implicit array type. Results:

    app.t column main branch
    vector ["vector"] ["vector"]
    vector[] [] ["vector"]
    domain over vector [] ["vector"]
    domain over that domain [] ["vector"]
    array of that domain [] ["vector"]
    integer[] [] []
  • The full suite is left to CI

Fixes #173

🤖 Generated with Claude Code

…preflight (S-007-7)

A citext[] column depends on the array type _citext, which depends on
citext with deptype 'i', not on the extension, so the preflight's needed
CTE never reached the extension member: citext was neither reported under
extensions nor passed to pg_dump --extension, and the restore failed.

The query now walks every type a selected object references to its array
element type (typcategory 'A', typelem) and its domain base type
(typbasetype), chained, before matching extension members, in the one
psql-variable-parameterised query that feeds both lists.

Fixes #173

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@shipmill-romamo
shipmill-romamo Bot merged commit 5721360 into main Oct 30, 2026
1 check passed
@shipmill-romamo
shipmill-romamo Bot deleted the fix/173-preflight-extension-arrays branch October 30, 2026 15:46
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 data copy preflight misses extension arrays, extensions in other schemas, and some auth references

0 participants