db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bryan Pendleton (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-2085) Misleading error message for non-matching ORDER BY clause in queries with GROUP BY.
Date Sat, 26 Apr 2008 18:32:55 GMT

    [ https://issues.apache.org/jira/browse/DERBY-2085?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12592590#action_12592590
] 

Bryan Pendleton commented on DERBY-2085:
----------------------------------------

In a query such as this one, which of the two error messages (42Y30, 42Y36)
is superior?

  select c1+1, count(*) from test group by c1+2

Would we rather see:

  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.

or

  ERROR 42Y36: Column reference 'C1' is invalid. For a SELECT list with a 
  GROUP BY,the list may only contain grouping columns and valid aggregate expressions

I think either message is ok, I don't feel a strong preference one way or
the other. However, the same code path is currently taken for this case
as is taken for the repro case:

  SELECT i FROM t GROUP BY i ORDER BY j

So if we feel that we need to get 42Y30 in the one case, but 42Y36 in the
other, we'll need to figure out how to get VerifyAggregateExpressionsVisitor
to be able to distinguish the one case from the other.


> Misleading error message for non-matching ORDER BY clause in queries with GROUP BY.
> -----------------------------------------------------------------------------------
>
>                 Key: DERBY-2085
>                 URL: https://issues.apache.org/jira/browse/DERBY-2085
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.2.1.6
>         Environment: Any
>            Reporter: Øystein Grøvlen
>            Assignee: Bryan Pendleton
>            Priority: Trivial
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message