Skip to content

fix: support non-parent interleaving and parent enforcement changes - #251

Open
cliff-openai wants to merge 3 commits into
cloudspannerecosystem:mainfrom
cliff-openai:cliff/fix-non-parent-on-delete
Open

fix: support non-parent interleaving and parent enforcement changes#251
cliff-openai wants to merge 3 commits into
cloudspannerecosystem:mainfrom
cliff-openai:cliff/fix-non-parent-on-delete

Conversation

@cliff-openai

@cliff-openai cliff-openai commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Fix this tool's handling of INTERLEAVE IN clauses in multiple ways. It now supports adding/removing the PARENT keyword and changing the ON DELETE clause.

Cloud Spanner does not allow ON DELETE actions on non-parent INTERLEAVE IN relationships. The serializer currently applies the parent relationship's implicit ON DELETE NO ACTION default to both forms, causing otherwise valid schema diffs to generate DDL that Spanner rejects.

Preserve the copied emulator grammar while mirroring its semantic distinction in the Java AST and validation layer. Non-parent relationships now serialize without an ON DELETE clause, invalid explicit actions are rejected, and existing non-parent tables can be compared without a null dereference.

Add parser and diff regressions for creating and altering non-parent-interleaved tables.
Cloud Spanner can add or remove parent enforcement without changing the physical interleave target. Treating the PARENT keyword as part of the target incorrectly rejects valid in-place migrations, including dropping ON DELETE CASCADE when an existing child becomes independently writable.

Compare the physical target separately from enforcement, generate SET INTERLEAVE IN transitions in both directions, and apply non-default delete actions only after parent enforcement is restored.
The previous getParentTableName helper returned either a bare table name or a PARENT-prefixed SQL fragment, so its name concealed whether the value represented a physical table or enforcement syntax.

Render the complete INTERLEAVE IN target clause in one explicitly named helper and reuse it for CREATE TABLE serialization and ALTER TABLE enforcement migrations.
@cliff-openai cliff-openai changed the title fix: preserve non-parent interleave DDL fix: support non-parent interleaving and parent enforcement changes Aug 17, 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.

1 participant