Skip to content

Generate SQL foreign keys from the referenced value - #1973

Open
hoco-scy wants to merge 2 commits into
masterfrom
codex/evomaster-generated-sql-foreign-key
Open

hoco-scy wants to merge 2 commits into
masterfrom
codex/evomaster-generated-sql-foreign-key

Conversation

@hoco-scy

@hoco-scy hoco-scy commented Dec 1, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

When generating test setup, SqlWriter assumes that a foreign key targeting an auto-increment column must use a generated-key reference. The search can explicitly supply a value for that same column. The generated test then uses a different setup from the search.

Fix and rationale

Use the same referenced-gene check as SqlActionTransformer. Emit the value if it is printable, including an explicit value in an auto-increment column; use a generated-key reference only for a non-printable key. The existing-data and null paths remain unchanged.

Affected SUTs and trigger

A proxyprint replay failed in SQL setup after an explicitly inserted primary key was followed by a generated-key lookup. The missing mapping is directly observed; the reconstructed SQL fixture is not a full rerun of the original method.

Verification

On master at c45c90e, the new composite-key case emits a generated-key reference instead of its explicit value. With this change both SqlWriterTest cases pass locally (JDK 21).

Split out of #1926; this PR has no dependency on the other fixes.

Evidence boundary

This branch checks composite-key source generation, and compiles and executes generated Java/Kotlin SQL with explicit, database-generated and existing keys. Four SqlWriterTest cases passed on this branch.

@hoco-scy hoco-scy closed this Dec 1, 2026
@hoco-scy hoco-scy reopened this Dec 3, 2026
@hoco-scy
hoco-scy force-pushed the codex/evomaster-generated-sql-foreign-key branch from b6454fe to fc2652e Compare December 3, 2026 12:26
@hoco-scy
hoco-scy marked this pull request as ready for review December 4, 2026 02:47
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