Environment
- pgschema v1.12.3
- PostgreSQL 17.x (Supabase PostgreSQL image)
plan uses an external PostgreSQL plan database via --plan-host
- Target schema is a Supabase application database with multiple application schemas
Problem
pgschema plan fails when a partitioned parent table and one of its partition children are in different schemas, even when the external plan database contains the relevant schemas and objects.
Observed structure:
- Partitioned parent:
public.annotation_shapes
- Default partition:
annotations_data.annotation_shapes_default
The desired SQL generated for the annotations_data schema contains a statement equivalent to:
CREATE TABLE IF NOT EXISTS annotation_shapes_default
PARTITION OF public.annotation_shapes (...) DEFAULT;
Planning the annotations_data schema fails while applying the desired SQL to the temporary plan schema:
partition "annotation_shapes_default" conflicts with existing default partition "annotation_shapes_default" (SQLSTATE 42P17)
Reproduction shape
- Dump the child schema:
pgschema dump \
--host <target-host> \
--db <database> \
--user <user> \
--schema annotations_data \
--qualify-schema > annotations_data.sql
- Generate a plan for that schema using a dedicated external plan database:
pgschema plan \
--host <target-host> \
--db <database> \
--user <user> \
--schema annotations_data \
--file annotations_data.sql \
--plan-host <plan-host> \
--plan-db <plan-db> \
--plan-user <plan-user>
The failure occurs before a usable migration plan is produced. No apply was executed against the target database.
Expected behavior
The plan database should construct the desired state without creating a duplicate/conflicting partition, then produce a reviewable plan for the target schema.
Notes
This appears distinct from cross-schema foreign-key handling in #122, #284, and #548. The issue is specifically the interaction between per-schema planning and a partition child whose parent is in another schema.
The general partition fixes in #496/#498 and #499 are already included in v1.12.x, but they do not appear to cover this cross-schema parent/child case.
Environment
planuses an external PostgreSQL plan database via--plan-hostProblem
pgschema planfails when a partitioned parent table and one of its partition children are in different schemas, even when the external plan database contains the relevant schemas and objects.Observed structure:
public.annotation_shapesannotations_data.annotation_shapes_defaultThe desired SQL generated for the
annotations_dataschema contains a statement equivalent to:Planning the
annotations_dataschema fails while applying the desired SQL to the temporary plan schema:Reproduction shape
The failure occurs before a usable migration plan is produced. No
applywas executed against the target database.Expected behavior
The plan database should construct the desired state without creating a duplicate/conflicting partition, then produce a reviewable plan for the target schema.
Notes
This appears distinct from cross-schema foreign-key handling in #122, #284, and #548. The issue is specifically the interaction between per-schema planning and a partition child whose parent is in another schema.
The general partition fixes in #496/#498 and #499 are already included in v1.12.x, but they do not appear to cover this cross-schema parent/child case.