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

Window Function Expressions Wrong Results

    XMLWordPrintable

Details

    Description

      The following query returns incorrect results:

      create table t(a decimal(35,10), b int);
      insert into t(a,b) values(1,1);
      insert into t(a,b) values(2,1);
      insert into t(a,b) values(0,1);
      select * from t;
      a	b
      1.0000000000	1
      2.0000000000	1
      0.0000000000	1
      select sum(t.a) over (partition by t.b) as s1, sum(t.a) over (partition by t.b) + 1 as s2
      from t;
      s1	s2
      3.0000000000	1.0000000000
      3.0000000000	1.0000000000
      3.0000000000	1.0000000000
      

      s2 should be s1 + 1, not the constant 1

      Attachments

        Issue Links

          Activity

            People

              psergei Sergei Petrunia
              cvicentiu Vicențiu Ciorbaru
              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.