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

support FOR loop in stored aggregate functions

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Stalled (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Fix Version/s: None
    • Component/s: Stored routines
    • Labels:
      None

      Description

      Support the syntax (subject to discussion):

      [begin_label:]
      FOR GROUP ROWS DO
        statement_list
      END FOR [ end_label ]
      

      See also MDEV-14415.

      Example:

      CREATE AGGREGATE FUNCTION avg(x DOUBLE) RETURNS DOUBLE
      BEGIN
        DECLARE count INT DEFAULT 0;
        DECLARE sum DOUBLE DEFAULT 0;
        FOR GROUP ROWS DO
          SET count:=count+1;
          SET sum:=sum+x;
        END FOR;
        RETURN sum/count;
      END
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              serg Sergei Golubchik
              Votes:
              0 Vote for this issue
              Watchers:
              6 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.