Repository navigation
Restrict BOOL columns to boolean values - #1841
Merged
Merged
Conversation
The "true"/"false" domain was only asserted for columns declared BOOLEAN, although TYPE_MAP and gene reconstruction also accept BOOL (PostgreSQL's spelling). A bool column could take any string, so WHERE active <> false yielded "", read back as false. Both now use a single set of boolean spellings.
agusaldasoro
marked this pull request as ready for review
October 7, 2026 12:51
jgaleotti
approved these changes
Oct 7, 2026
arcuri82
approved these changes
Oct 7, 2026
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.
Problem
A boolean column is encoded as an SMT
String, andSmtLibGenerator.appendBooleanConstraintsrestricts it to"true"or"false". That restriction was only applied when the declared type was exactlyBOOLEAN.TYPE_MAPalso acceptsBOOL, which is how PostgreSQL reports a boolean column, andSMTLibZ3DbConstraintSolveralready treats it as boolean when rebuilding genes (BOOLEAN_SPELLINGS).A
boolcolumn therefore had no domain, and Z3 could give it any string. ForWHERE active <> false, Z3 picks"".toBoolean("")reads that back asfalse, so the generated row violates the very query it was generated for.Fix
SmtLibGenerator.BOOLEAN_TYPES(BOOLEAN,BOOL) is the single set of boolean spellings.appendBooleanConstraintsuses it, so aboolcolumn gets the same domain as aBOOLEANone.SMTLibZ3DbConstraintSolver.BOOLEAN_SPELLINGSnow refers to the same set instead of repeating it, so the domain constraint and the gene reconstruction cannot drift apart again.Tests
New
BooleanColumnSolvingTest.boolSpellingIsRestrictedToBooleanValues, end to end against Z3. It uses the same H2 table with the column type set to"bool"and solvesWHERE active <> falseandWHERE active <> true. Onmaster, the first case fails withexpected: <true> but was: <false>. The second one only passes onmasterbecause""happens to read back asfalse.All tests under
org.evomaster.core.database.sql.solverpass.