Skip to content

docs: clarify _propagate_part_to_master materialization is delete-order, not just MySQL 1093#1495

Open
dimitri-yatsenko wants to merge 1 commit into
masterfrom
docs/cascade-materialization-rationale
Open

docs: clarify _propagate_part_to_master materialization is delete-order, not just MySQL 1093#1495
dimitri-yatsenko wants to merge 1 commit into
masterfrom
docs/cascade-materialization-rationale

Conversation

@dimitri-yatsenko

Copy link
Copy Markdown
Member

Follow-up from the 2.3.1 dj.Diagram review. The _propagate_part_to_master docstring justified the to_arrays() master materialization purely as a MySQL-1093 workaround. That framing is incomplete and risks a well-intentioned "PostgreSQL has no 1093, so skip it" change that would be a silent integrity/data-loss bug.

The real, backend-independent reason: Table.delete deletes per-table in reverse-topological order (table.py:1089), so a Part is deleted before its Master. The Master's restriction is derived from that Part; left as a live subquery it evaluates to empty once the Part is gone, and the Master escapes deletion — reintroducing the compositional-integrity violation the upward walk exists to prevent. Materializing the Master PKs at plan time captures them before any deletion. MySQL 1093 is a secondary consequence.

Docstring-only; no behavior change.

…ot just MySQL 1093

Rewrite the docstring to lead with the backend-independent reason: Table.delete deletes in reverse-topological order, so a Part is deleted before its Master; a live master restriction derived from the Part would evaluate empty and the Master would escape deletion. MySQL 1093 is a secondary consequence. Prevents a future MySQL-only 'optimization' that would be a silent integrity bug on PostgreSQL.
@dimitri-yatsenko dimitri-yatsenko added this to the v2.3.1 milestone Jul 15, 2026
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.

2 participants