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

Clarify GROUP_CONCAT wording

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Fixed
    • None
    • N/A
    • Documentation
    • None

    Description

      Question from Zulip:

      "Based on the KB documentation, what do you expect the following GROUP_CONCAT expression to return?

      I quote the KB:

      This function returns a string result with the concatenated non-NULL values from a group. It returns NULL if there are no non-NULL values.

      Now for this SQL:

      create table t1 (a int, b char);
      insert into t1 values (1, 'a'), (2, NULL)
      SELECT GROUP_CONCAT(a, b) FROM t1;

      While after running the SQL statements it makes sense, when first reading the docs I wasn't sure whether to expect something like:

      1a, 2NULL
      or
      1a
      or
      1a,2

      because the word group might be associated with "expressions group". I suggest we clarify by saying: if any expr in GROUP_CONCAT evaluates to NULL, that tuple is not present in the list returned by GROUP_CONCAT.

      Alternatively change the word "concatenated" with a comma separated list of values. The values are a concatenation of all expressions in GROUP_CONCAT where all expressions evaluate
      to non-null for that particular ROW in the GROUP."

      Attachments

        Activity

          People

            greenman Ian Gilfillan
            greenman Ian Gilfillan
            Votes:
            0 Vote for this issue
            Watchers:
            1 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.