Uploaded image for project: 'Apache MetaModel'
  1. Apache MetaModel
  2. METAMODEL-1169

MS Sql and queries with WHERE part on datetime or timestamp columns lost milliseconds precision

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 4.5.5
    • Fix Version/s: 4.6.1, 5.0.1
    • Labels:
      None

      Description

      An example, where a query is constructed that compares some `datetime` column with a value.

      Query q = ...
      java.util.Date datetimeValue = createDatetime('2017-01-01 12:00:00.500');
      q.where(column, OperatorType.GREATER_THAN, datetimeValue);
      

      If there is a row with the appropriate column value for example `2017-01-01 12:00:00.157`, this row should NOT be selected, but currently it IS, since the milliseconds are trimmed to 0 in the query operand.

      Only on MS SQL database. The problem is probably in `SQLServerQueryRewriter.rewriteFilterItem` class & method.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              jakub.neubauer Jakub Neubauer
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: