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

ONLY_FULL_GROUP_BY silently bypassed for outer-correlated fields inside aggregate

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Blocker
    • Resolution: Unresolved
    • N/A
    • 13.2
    • None
    • None
    • Q4/2026 Server Maintenance

    Description

      SET sql_mode='ONLY_FULL_GROUP_BY';
      CREATE TABLE t0 (a INT, b INT, c INT);
      CREATE TABLE t1 (b INT);
      INSERT INTO t0 VALUES (1,10,100),(1,20,200),(2,30,300);
      INSERT INTO t1 VALUES (1000);
       
      #here error as expected:
      --error 1055
      SELECT (SELECT sum(t0.b + t1.b) FROM t1) AS s, t0.c FROM t0 GROUP BY t0.a;
       
      #here error is also expected:
      SELECT t0.a, (SELECT sum(t0.b + t1.b) FROM t1) AS s FROM t0 GROUP BY t0.a;
      SELECT t0.a, (SELECT any_value(t0.b + t1.b) FROM t1) AS s FROM t0 GROUP BY t0.a;
       
      DROP TABLE t0, t1;
      SET sql_mode=DEFAULT;
      

      regression after pr 5151 (715a937e98c ?)

      on main:

      query 'SELECT t0.a, (SELECT sum(t0.b + t1.b) FROM t1) AS s FROM t0 GROUP BY t0.a' failed: ER_WRONG_FIELD_WITH_GROUP (1055): 'test.t0.b' isn't in GROUP BY
      

      Attachments

        Issue Links

          Activity

            People

              danblack Daniel Black
              alice Alice Sherepa
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - 3h 17m
                  3h 17m
                  Remaining:
                  Remaining Estimate - 3h 17m
                  3h 17m
                  Logged:
                  Time Spent - Not Specified
                  Not Specified

                  Git Integration

                    Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.