Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-8911

Date comparaison to string failed with '=' and ISO DATE

    Details

    • Type: Bug
    • Status: Confirmed (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 10.0.20, 10.0, 10.1
    • Fix Version/s: 10.0, 10.1
    • Component/s: Optimizer
    • Labels:
    • Environment:
      linux, ubuntu trusty docker, mariadb 10.0.20-MariaDB-1~trusty-wsrep-log

      Description

      Date comparison fail on the datetime fields only on strict comparisons

      Table format

      +------------------+--------------+------+-----+---------+-------+
      | Field            | Type         | Null | Key | Default | Extra |
      +------------------+--------------+------+-----+---------+-------+
      | processingdate   | datetime     | YES  |     | NULL    |       |
      +------------------+--------------+------+-----+---------+-------+

      Table content

      select processingdate from rbs_order_doc_shipment ;
      +---------------------+
      | processingdate      |
      +---------------------+
      | NULL                |
      | 2015-10-06 15:24:47 |
      | NULL                |
      | 2015-10-06 15:27:38 |
      | 2015-10-06 19:14:52 |
      | 2015-10-06 19:14:52 |
      | 2015-10-06 19:14:52 |
      | 2015-10-07 06:04:30 |
      +---------------------+

      Query on error

      select processingdate from rbs_order_doc_shipment where processingdate = '2015-10-06T19:14:52+0000' ;
      Empty set (0.00 sec)

      But those works:

      select processingdate from rbs_order_doc_shipment where processingdate <= '2015-10-06T19:14:52+0000' ;
      +---------------------+
      | processingdate      |
      +---------------------+
      | 2015-10-06 15:24:47 |
      | 2015-10-06 15:27:38 |
      | 2015-10-06 19:14:52 |
      | 2015-10-06 19:14:52 |
      | 2015-10-06 19:14:52 |
      +---------------------+

      select processingdate from rbs_order_doc_shipment where processingdate >= '2015-10-06T19:14:52+0000'   limit 10;
      +---------------------+
      | processingdate      |
      +---------------------+
      | 2015-10-06 19:14:52 |
      | 2015-10-06 19:14:52 |
      | 2015-10-06 19:14:52 |
      | 2015-10-07 06:04:30 |
      +---------------------+

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                psergey Sergei Petrunia
                Reporter:
                bnprss Benjamin Preiss
              • Votes:
                1 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated: