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

support FOR loop in stored aggregate functions

    XMLWordPrintable

Details

    • Task
    • Status: Stalled (View Workflow)
    • Major
    • Resolution: Unresolved
    • None
    • Stored routines
    • 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

              Unassigned Unassigned
              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.