Skip to content

Map BLOB column types and write their values in hex on H2 - #1855

Merged
arcuri82 merged 2 commits into
masterfrom
fix/smtlib-blob-type
Oct 15, 2026
Merged

arcuri82 merged 2 commits into
masterfrom
fix/smtlib-blob-type

Conversation

@agusaldasoro

@agusaldasoro agusaldasoro commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

BLOB columns had no entry in TYPE_MAP. Every table of the schema is declared for every query, so a single BLOB column made SMT-LIB generation fail for all queries of the schema.

The value also needs care. H2 1.4 reads a string literal given for a binary column as hexadecimal, so a value such as "abc" makes it reject the INSERT (Hexadecimal string with odd number of characters). H2 2.x, MySQL and PostgreSQL accept any text.

Fix

  • SmtLibGenerator.BLOB_TYPES: maps every spelling to String:
    • BINARY LARGE OBJECT (H2 2.x)
    • BLOB (H2 1.4, MySQL)
    • TINYBLOB, MEDIUMBLOB, LONGBLOB (MySQL)
  • SMTLibZ3DbConstraintSolver.binaryValue: on H2, writes the value of a BLOB column as the hex of its UTF-8 bytes, which both H2 versions accept. The mapping is injective, so the equalities the formula imposes (unique and primary keys) still hold. Other databases get the value as is. It is reached from validTextValue (Generate valid UUID, JSON and JSONB values #1849), which handles UUID and JSON columns and passes every other value on.

The values stay plain SMT Strings, so solving costs the same as before.

Tests

  • New BlobColumnSolvingTest (H2, Z3 Docker). On master both cases fail, because the solver returns no action:
    • a query on a table with a BLOB column is solved, and the row is inserted and returned by the query;
    • with the column reported as BLOB (as H2 1.4 does), WHERE data = 'abc' produces the value 616263, and the row is inserted.
  • UntranslatableQueryCacheTest and UnmappedColumnTypeTest: used a BLOB column as their example of an unmapped type. They now use INTERVAL YEAR.

All tests under org.evomaster.core.database.sql.solver pass.

🤖 Generated with Claude Code

@agusaldasoro
agusaldasoro marked this pull request as ready for review October 8, 2026 17:45
@agusaldasoro
agusaldasoro requested a review from jgaleotti October 8, 2026 17:45
@agusaldasoro
agusaldasoro requested a review from arcuri82 October 9, 2026 09:06
@arcuri82

Copy link
Copy Markdown
Collaborator

@agusaldasoro hi there are merge conflicts

# Conflicts:
#	core/src/main/kotlin/org/evomaster/core/database/sql/solver/service/SMTLibZ3DbConstraintSolver.kt
@agusaldasoro

Copy link
Copy Markdown
Collaborator Author

@agusaldasoro hi there are merge conflicts

Fixed!

@arcuri82
arcuri82 merged commit f2b1395 into master Oct 15, 2026
33 checks passed
@arcuri82
arcuri82 deleted the fix/smtlib-blob-type branch October 15, 2026 11:58
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.

3 participants