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

Different result for time type with optimizer_use_condition_selectivity=4

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Duplicate
    • 10.1.18, 10.1(EOL), 10.2(EOL)
    • N/A
    • Optimizer
    • None
    • 10.2.4-1, 10.1.22

    Description

      Test case

      --disable_warnings
      drop table if exists t1;
      --enable_warnings
       
      SET timestamp=DEFAULT;
       
      SET @@old_mode=zero_date_time_cast;
      --echo # TIMESTAMP literal, old mode
      CREATE TABLE t1 (a TIME);
      INSERT INTO t1 VALUES ('0000-00-00 10:20:30'),('0000-00-00 10:20:31');
      INSERT INTO t1 VALUES ('0000-00-01 10:20:30'),('0000-00-01 10:20:31');
      INSERT INTO t1 VALUES ('31 10:20:30'),('32 10:20:30'),('33 10:20:30'),('34 10:20:30');
      SELECT * FROM t1;
       
      --echo # Old mode, TIMESTAMP-alike literal, zon-zero YYYYMMDD, no propagation
      SELECT * FROM t1 WHERE a='0000-00-01 10:20:30';
      SELECT * FROM t1 WHERE a='0000-00-01 10:20:30' AND LENGTH(a)=8;
      EXPLAIN EXTENDED
      SELECT * FROM t1 WHERE a='0000-00-01 10:20:30' AND LENGTH(a)=8;
      EXPLAIN EXTENDED
      SELECT * FROM t1 WHERE a='0000-00-01 10:20:30' AND LENGTH(a)=30+RAND();
       
      DROP TABLE t1;
      

      With : @@optimizer_use_condition_selectivity=1

      SELECT * FROM t1 WHERE a='0000-00-01 10:20:30';
      a
      34:20:30
      SELECT * FROM t1 WHERE a='0000-00-01 10:20:30' AND LENGTH(a)=8;
      a
      34:20:30
      

      With : @@optimizer_use_condition_selectivity=4

      SELECT * FROM t1 WHERE a='0000-00-01 10:20:30';
      a
      SELECT * FROM t1 WHERE a='0000-00-01 10:20:30' AND LENGTH(a)=8;
      a
      

      Attachments

        Issue Links

          Activity

            People

              cvicentiu Vicențiu Ciorbaru
              nirbhay_c Nirbhay Choubey (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 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.