Repository navigation
Encode DATE columns like TIMESTAMP ones - #1846
Draft
agusaldasoro wants to merge 1 commit into
Draft
agusaldasoro wants to merge 1 commit into
agusaldasoro wants to merge 1 commit into
Conversation
A DATE column was an unbounded SMT Int inserted as a bare integer, which the database rejects, so no row of a table with a DATE column was ever inserted; DATE literals were not parsed at all. DATE now shares the TIMESTAMP encoding, epoch seconds at midnight UTC: it is bounded, kept to whole days, rebuilt as yyyy-MM-dd, and DATE literals are parsed.
agusaldasoro
added this pull request to stack #1848
October 7, 2026 12:56
agusaldasoro
removed this pull request from stack #1848
October 7, 2026 13:04
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
DATEwas mapped to an SMTIntinTYPE_MAP, likeTIMESTAMP, but none of theTIMESTAMPhandling applied to it:SMTLibZ3DbConstraintSolverbuilt a plainLongGene, so the INSERT carried the bare integer, e.g.INSERT INTO EV (D, …) VALUES (2, …). H2 rejects it withData conversion error.DATE '2024-01-01'threw "Extraction of condition not yet implemented" in the condition parser, so the wholeWHEREclause was dropped.As a result, no row of a table with a
DATEcolumn was ever inserted, whatever the query. The failure is silent, becauseSqlScriptRunner.execInsertlogs a failed insertion and carries on.Fix
DATEnow shares theTIMESTAMPencoding: epoch seconds, at midnight UTC.SmtLibGenerator: aDATEcolumn gets the same epoch bounds as aTIMESTAMPone, plus(= (mod col 86400) 0)so the value is a whole day.DATE_TYPEis a constant next toTIMESTAMP_TYPE.SMTLibZ3DbConstraintSolver: aDATEvalue is rebuilt as'yyyy-MM-dd', the same way aTIMESTAMPvalue is rebuilt as'yyyy-MM-dd HH:mm:ss'.JSqlVisitor(dbconstraint):DATE 'yyyy-MM-dd'and the JDBC escape{d 'yyyy-MM-dd'}become the epoch seconds of that midnight, UTC.Sharing the unit with
TIMESTAMPalso makes a comparison between aDATEcolumn and aTIMESTAMPliteral work.Tests
DateColumnSolvingTest, end to end against Z3 and H2. Forid = 1,d = DATE '2024-03-05',d > DATE '2024-01-01'andd > TIMESTAMP '2024-01-01 10:00:00', it solves the query, checks that the generated row is inserted (viaexecutionResults, since failures are not thrown), and checks that the query returns it. All four fail onmasterwithexpected: <[true]> but was: <[false]>.WhereClauseTranslationLimitsTest: a new case checks thatDATE '…'and{d '…'}encode as the epoch of their midnight.All tests in
core-extra/dbconstraintand underorg.evomaster.core.database.sql.solverpass.Out of scope
A quoted string compared against a
DATEorTIMESTAMPcolumn, e.g.d > '2024-01-01', still compares anIntwith aStringand gets no data. That is a separate follow-up.