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

Possibly wrong result with a query comparing a date field to a char constant.

    XMLWordPrintable

Details

    Description

      After the commit on 10.1 tree, the provided test case started producing a different result.

      commit 8bd4716272ef16a4bcd3196ba62f249aa3878998
      Merge: 26e048f f8f8a59
      Author: Sergei Petrunia <psergey@askmonty.org>
      Date:   Tue Sep 9 13:05:28 2014 +0400
       
          Merge ../10.1-orderby-fixes into 10.1

      I'm not quite sure which result is correct, but I want to make sure that the change was intentional.

      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (a INT, b INT, d DATE, KEY(d));
      INSERT INTO t1 VALUES (1,7,'1900-01-01'),(4,0,'0000-00-00');
      SELECT * FROM t1 WHERE d = 'c' OR b >= a;
      DROP TABLE t1;

      Old result

      a	b	d
      1	7	1900-01-01
      4	0	0000-00-00

      Old EXPLAIN

      id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
      1	SIMPLE	t1	ALL	d	NULL	NULL	NULL	2	100.00	Using where
      Warnings:
      Note	1003	select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`d` AS `d` from `test`.`t1` where ((`test`.`t1`.`d` = 'c') or (`test`.`t1`.`b` >= `test`.`t1`.`a`))

      New result

      a	b	d
      1	7	1900-01-01

      New EXPLAIN

      id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
      1	SIMPLE	t1	ALL	d	NULL	NULL	NULL	2	100.00	Using where
      Warnings:
      Note	1003	select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`d` AS `d` from `test`.`t1` where ((`test`.`t1`.`b` >= `test`.`t1`.`a`))
      DROP TABLE t1;

      Attachments

        Activity

          People

            psergei Sergei Petrunia
            elenst Elena Stepanova
            Votes:
            1 Vote for this issue
            Watchers:
            5 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.