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

No warning when comparing a DATETIME column to a negative TIME value

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Won't Fix
    • 10.0.8
    • N/A
    • Temporal Types
    • None

    Description

      If I compare a DATETIME column to a negative TIME value,
      it does not print any warnings:

      mysql> drop table if exists t1; create table t1 (f1 datetime, key (f1));  insert into t1 values ('2000-09-12 00:00:00'), ('2007-04-25 05:08:49'); select * from t1 where f1 > time('-00:00:01'); 
      Query OK, 0 rows affected (0.05 sec)
       
      Query OK, 0 rows affected (0.18 sec)
       
      Query OK, 2 rows affected (0.00 sec)
      Records: 2  Duplicates: 0  Warnings: 0
       
      +---------------------+
      | f1                  |
      +---------------------+
      | 2000-09-12 00:00:00 |
      | 2007-04-25 05:08:49 |
      +---------------------+
      2 rows in set (0.00 sec)

      At the same time it does print warnings for negative number:

      mysql> select * from t1 where f1 > -1;
      +---------------------+
      | f1                  |
      +---------------------+
      | 2000-09-12 00:00:00 |
      | 2007-04-25 05:08:49 |
      +---------------------+
      2 rows in set, 1 warning (0.00 sec)
       
      mysql> show warnings;
      +---------+------+--------------------------------+
      | Level   | Code | Message                        |
      +---------+------+--------------------------------+
      | Warning | 1292 | Incorrect datetime value: '-1' |
      +---------+------+--------------------------------+
      1 row in set (0.00 sec)

      Comparison to TIME should be fixed to print the warning.

      Attachments

        Activity

          People

            bar Alexander Barkov
            bar Alexander Barkov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.