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

Suran Jayathilaka commented on DERBY-2085:
------------------------------------------

When runnig the test
org.apache.derbyTesting.functionTests.tests.lang.GroupByTest
in soft upgrade mode with 10.4.2.0 -> 10.5.1.0 (RC1) I came across these 
failures. The failures occur when the the test is run alone, as well as as part 
of suites.All.

35) 
testGroupByErrors(org.apache.derbyTesting.functionTests.tests.lang.GroupByTest)junit.framework.ComparisonFailure:
 Unexpected SQL state. expected:<42Y3[0]> but was:<42Y3[6]>
        at 
org.apache.derbyTesting.junit.BaseJDBCTestCase.assertSQLState(BaseJDBCTestCase.java:752)
        at 
org.apache.derbyTesting.junit.BaseJDBCTestCase.assertSQLState(BaseJDBCTestCase.java:801)
        at 
org.apache.derbyTesting.junit.BaseJDBCTestCase.assertStatementError(BaseJDBCTestCase.java:970)
        at 
org.apache.derbyTesting.junit.BaseJDBCTestCase.assertStatementError(BaseJDBCTestCase.java:992)
        at 
org.apache.derbyTesting.functionTests.tests.lang.GroupByTest.testGroupByErrors(GroupByTest.java:244)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at 
org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:102)
        at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
        at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
        at junit.extensions.TestSetup.run(TestSetup.java:25)
        at 
org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)
Caused by: java.sql.SQLSyntaxErrorException: Column reference 'T1.A' is 
invalid, or is part of an invalid expression.  For a SELECT list with a GROUP 
BY, the columns and expressions being selected may only contain valid grouping 
expressions and valid aggregate expressions.
        at 
org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source)
        at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown 
Source)
        at 
org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
Source)
        at 
org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
Source)
        at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown 
Source)
        at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown 
Source)
        at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
        at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
        at 
org.apache.derbyTesting.junit.BaseJDBCTestCase.assertStatementError(BaseJDBCTestCase.java:960)
        ... 29 more
Caused by: java.sql.SQLException: Column reference 'T1.A' is invalid, or is 
part of an invalid expression.  For a SELECT list with a GROUP BY, the columns 
and expressions being selected may only contain valid grouping expressions and 
valid aggregate expressions.
        at 
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
        at 
org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown
 Source)
        ... 38 more
Caused by: ERROR 42Y36: Column reference 'T1.A' is invalid, or is part of an 
invalid expression.  For a SELECT list with a GROUP BY, the columns and 
expressions being selected may only contain valid grouping expressions and 
valid aggregate expressions.
        at org.apache.derby.iapi.error.StandardException.newException(Unknown 
Source)
        at 
org.apache.derby.impl.sql.compile.VerifyAggregateExpressionsVisitor.visit(Unknown
 Source)
        at org.apache.derby.impl.sql.compile.QueryTreeNode.accept(Unknown 
Source)
        at org.apache.derby.impl.sql.compile.ResultColumn.accept(Unknown Source)
        at org.apache.derby.impl.sql.compile.QueryTreeNodeVector.accept(Unknown 
Source)
        at org.apache.derby.impl.sql.compile.SelectNode.bindExpressions(Unknown 
Source)
        at 
org.apache.derby.impl.sql.compile.DMLStatementNode.bindExpressions(Unknown 
Source)
        at org.apache.derby.impl.sql.compile.DMLStatementNode.bind(Unknown 
Source)
        at org.apache.derby.impl.sql.compile.CursorNode.bindStatement(Unknown 
Source)
        at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
        at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
        at 
org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown
 Source)
        ... 32 more

Also in testDistinctGroupBy.

Should a release note have been made regarding this message change?

Thanks!
Suran


> 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
>             Fix For: 10.5.0.0
>
>         Attachments: newMsgWithTest.diff
>
>
> 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.

Reply via email to