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

Results of IFNULL(NULL,LAST_VALUE(a) OVER ()) are non-deterministic;

    XMLWordPrintable

Details

    Description

      CREATE TABLE t(a INT, b INT);
      INSERT INTO t VALUES (100,1), (200,1),(300,2),(400,2),(500,3),(600,3);
      SELECT IFNULL(NULL,LAST_VALUE(a) OVER ()) from t;
      

      MariaDB [test]> SELECT IFNULL(NULL,LAST_VALUE(a) OVER ()) from t;
      +------------------------------------+
      | IFNULL(NULL,LAST_VALUE(a) OVER ()) |
      +------------------------------------+
      |                                600 |
      |                                600 |
      |                                600 |
      |                                600 |
      |                                600 |
      |                                600 |
      +------------------------------------+
      6 rows in set (0.00 sec)
       
      MariaDB [test]> SELECT IFNULL(NULL,LAST_VALUE(a) OVER ()) from t;
      +------------------------------------+
      | IFNULL(NULL,LAST_VALUE(a) OVER ()) |
      +------------------------------------+
      |                                100 |
      |                                100 |
      |                                100 |
      |                                100 |
      |                                100 |
      |                                100 |
      +------------------------------------+
      6 rows in set (0.00 sec)
       
      MariaDB [test]> SELECT IFNULL(NULL,LAST_VALUE(a) OVER ()) from t;
      +------------------------------------+
      | IFNULL(NULL,LAST_VALUE(a) OVER ()) |
      +------------------------------------+
      |                                200 |
      |                                200 |
      |                                200 |
      |                                200 |
      |                                200 |
      |                                200 |
      +------------------------------------+
      6 rows in set (0.00 sec)
      
      

      Attachments

        Activity

          People

            psergei Sergei Petrunia
            alice Alice Sherepa
            Votes:
            0 Vote for this issue
            Watchers:
            3 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.