Repository navigation
Fix foreign key gene - #1830
Draft
agusaldasoro wants to merge 1 commit into
Draft
Fix foreign key gene#1830agusaldasoro wants to merge 1 commit into
agusaldasoro wants to merge 1 commit into
Conversation
agusaldasoro
added this pull request to stack #1831
October 6, 2026 13:34
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.
Stacked on #1829.
Problem
The solver returned foreign key columns as plain value genes (
LongGene,StringGene, …), with no link to the action of the referenced row. Z3 makes the value match the referenced primary key, but only at generation time. Once the search mutates either side, the reference breaks. FK repair inSqlActionUtilscannot fix it, because it does not see the column as a foreign key.The root cause is that
findForeignKeyswas a stub returning an empty set (// TODO: Implement this method). TheTablethe solver rebuilt had no foreign keys at all.Fix
All changes are in
SMTLibZ3DbConstraintSolver:findForeignKeysrebuilds the table's foreign keys from the schema with the same rule asSqlInsertBuilder: when the schema names no target columns, the foreign key references the target table's primary key. A foreign key whose table or columns cannot be resolved is skipped.bindForeignKeysturns each foreign key column into aSqlForeignKeyGenebound to the referenced row's action (uniqueIdOfPrimaryKey= that action'sinsertionId). The referenced row is the earlier row of the target table whose target columns hold the values Z3 assigned to the source columns.otherSourceColumnsInCompositeFK.SqlPrimaryKeyGene(SqlForeignKeyGene), asSqlActionGeneBuilderdoes.SqlForeignKeyGenecannot refer to;toValueGene, with no behaviour change.