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

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 4.5.5
    • 4.6.1, 5.0.1
    • 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

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

            Dates

              Created:
              Updated:
              Resolved: