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

MEMBER OF with a non-utf8mb4 array is not matched to its GROUP BY expression: ER_WRONG_FIELD_WITH_GROUP

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • None
    • 13.3
    • JSON
    • None

    Description

      PR 5278 (MDEV-38591), commit 1fc515363eebd61684a9680c4a1f2ce831dcbac7.

      When the array argument of MEMBER OF is not utf8mb4 (a literal on a latin1 connection, or a latin1 column), Item_func_member_of::fix_length_and_dec replaces args[1] with a utf8mb4 converter. The select-list item, already fixed, is then not equal to the same expression written in GROUP BY, so it is not recognised as a grouping expression and a valid query fails with ONLY_FULL_GROUP_BY. With SET NAMES utf8mb4 and a literal array it works. IN in the same query works.

      SET NAMES latin1;
      CREATE TABLE t1 (a INT, b INT, c VARCHAR(20) CHARACTER SET latin1);
      INSERT INTO t1 VALUES (1,10,'[1]'),(1,20,'[1]'),(2,5,'[1]');
       
      SET sql_mode='ONLY_FULL_GROUP_BY';
       
      SELECT a MEMBER OF ('[1]') x, SUM(b) s FROM t1 GROUP BY a MEMBER OF ('[1]');
      SELECT a MEMBER OF (c) x, SUM(b) s FROM t1 GROUP BY a MEMBER OF (c);
       
      --echo # Control, no error
      SELECT a IN (1) x, SUM(b) s FROM t1 GROUP BY a IN (1);
       
      SET sql_mode=DEFAULT;
      DROP TABLE t1;
      

      query 'SELECT a MEMBER OF ('[1]') x, SUM(b) s FROM t1 GROUP BY a MEMBER OF ('[1]')' failed: ER_WRONG_FIELD_WITH_GROUP (1055): 'test.t1.a' isn't in GROUP BY
      

      JarirBob FYI

      Attachments

        Issue Links

          Activity

            People

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