Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-2085

Misleading error message for non-matching ORDER BY clause in queries with GROUP BY.

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Trivial
    • Resolution: Fixed
    • Affects Version/s: 10.2.1.6
    • Fix Version/s: 10.5.1.1
    • Component/s: SQL
    • Labels:
      None
    • Environment:
      Any
    • Issue & fix info:
      Release Note Needed
    • Bug behavior facts:
      Regression

      Description

      In 10.2, this query gives the following error message:

      ij> SELECT i FROM t GROUP BY i ORDER BY j;
      ERROR 42Y30: The SELECT list of a grouped query contains at least one invalid expression. If a SELECT list has a GROUP BY, the list may only contain valid grouping expressions and valid aggregate expressions.

      This is misleading since there is no invalid expression in the SELECT
      list. It is the ORDER BY clause that is wrong.

      I have marked this as an regression since the error message in 10.1 is
      more helpful (but still not correct):

      ij> SELECT i FROM t GROUP BY i ORDER BY j;
      ERROR 42Y36: Column reference 'J' is invalid. For a SELECT list with a GROUP BY, the list may only contain grouping columns and valid aggregate expressions.

        Attachments

        1. releaseNote.html
          2 kB
          Knut Anders Hatlen
        2. releaseNote.html
          2 kB
          Bryan Pendleton
        3. newMsgWithTest.diff
          8 kB
          Bryan Pendleton

          Issue Links

            Activity

              People

              • Assignee:
                bryanpendleton Bryan Pendleton
                Reporter:
                oysteing Oystein Grovlen
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: