You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Bryan Pendleton (JIRA)" <ji...@apache.org> on 2008/04/26 17:25:55 UTC

[jira] Commented: (DERBY-2085) Misleading error message for non-matching ORDER BY clause in queries with GROUP BY.

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

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

I actually think the 10.1 message (42Y36) is pretty good. It identifies that the column
that is causing the problem is 'J', and it provides the rules for what column references
are legal in a grouped select. It's a bit vague about what "the list" is, but otherwise
I think it's a pretty good message.

So it should be just a matter of issuing this message in the case in question,
with the appropriate column name, and then updating any affected tests (as well
as adding a few new ones).

I'll see if I can work up a patch.

If anyone wishes to suggest an improved wording for 42Y36, please do, and I'd
be glad to include that in the patch as well.

Here's one possibility; is it any better?

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

> 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.