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

ANY_VALUE is treated as aggregation, so returns error in combination with aggregation functions

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Not a Bug
    • None
    • N/A
    • Server
    • None
    • Not for Release Notes

    Description

      CREATE TABLE t (a INT);
      INSERT INTO t VALUES (1),(2),(3);
       
      SELECT SUM(ANY_VALUE(a)) FROM t;
      SELECT ANY_VALUE(SUM(a)) FROM t;
      SELECT COUNT(DISTINCT ANY_VALUE(a)) FROM t;
      

      MariaDB [test]> SELECT SUM(ANY_VALUE(a)) FROM t;
      ERROR 1111 (HY000): Invalid use of group function
      MariaDB [test]> SELECT ANY_VALUE(SUM(a)) FROM t;
      ERROR 1111 (HY000): Invalid use of group function
      MariaDB [test]> SELECT COUNT(DISTINCT ANY_VALUE(a)) FROM t;
      ERROR 1111 (HY000): Invalid use of group function
      

      while works in Mysql

      Attachments

        Activity

          People

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