fix: support non-parent interleaving and parent enforcement changes - #251
Open
cliff-openai wants to merge 3 commits into
Open
fix: support non-parent interleaving and parent enforcement changes#251cliff-openai wants to merge 3 commits into
cliff-openai wants to merge 3 commits into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix this tool's handling of
INTERLEAVE INclauses in multiple ways. It now supports adding/removing thePARENTkeyword and changing theON DELETEclause.