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

AS OF > TIMESTAMP_MAX_VALUE produces wrong result

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.11
    • None
    • Versioned Tables
    • None

    Description

      Reproduce

      --source include/have_innodb.inc
       
      create or replace table t1 (
        x int primary key,
        sys_trx_start bigint(20) unsigned as row start invisible,
        sys_trx_end bigint(20) unsigned as row end invisible,
        period for system_time (sys_trx_start, sys_trx_end)
      ) with system versioning engine innodb;
       
      create or replace table t2 (
        x int primary key,
        sys_trx_start timestamp(6) as row start invisible,
        sys_trx_end timestamp(6) as row end invisible,
        period for system_time (sys_trx_start, sys_trx_end)
      ) with system versioning engine innodb;
       
      insert into t1 values (1);
      insert into t2 values (1);
       
      select * from t1 for system_time as of '2038-12-30 00:00:00';
      select * from t2 for system_time as of '2038-12-30 00:00:00';
       
      drop tables t1, t2;
      

      Result

      select * from t1 for system_time as of '2038-12-30 00:00:00';
      x
      select * from t2 for system_time as of '2038-12-30 00:00:00';
      x
      

      Expected

      select * from t1 for system_time as of '2038-12-30 00:00:00';
      x
      1
      select * from t2 for system_time as of '2038-12-30 00:00:00';
      x
      1
      

      Notes

      Both timestamp and trx versioned tables (after MDEV-39384) do not print the result for AS OF > TIMESTAMP_MAX_VALUE. In the case of timestamp-based, TIMESTAMP_MAX_VALUE is set for row_end and the condition fails:

          case SYSTEM_TIME_AS_OF:
           ...
            cond2= newx Item_func_gt(thd, conds->field_end, conds->start.item);
      

      Fix

      A special case must be made to bring AS OF value to the maximum of TIMESTAMP_MAX_VALUE.

      Attachments

        Issue Links

          Activity

            People

              midenok Aleksey Midenkov
              midenok Aleksey Midenkov
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

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