[ https://issues.apache.org/jira/browse/DERBY-4371?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12861651#action_12861651 ]
C.S. Nirmal J. Fernando commented on DERBY-4371: ------------------------------------------------ Hi Bryan, I ran Junit tests for the new modification and there's a failure. Following is the output in JunitAll.out: orderby(org.apache.derbyTesting.functionTests.tests.lang.LangScripts)junit.framework.ComparisonFailure: Output at line 1736 expected:<[C1 |C2 ]> but was:<[ERROR 42879: The ORDER BY clause may not contain column 'expression', since the query specifies DISTINCT and that column does not appear in the query result.]> at org.apache.derbyTesting.functionTests.util.CanonTestCase.compareCanon(CanonTestCase.java:106) at org.apache.derbyTesting.functionTests.util.ScriptTestCase.runTest(ScriptTestCase.java:198) at org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:109) 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) Where can I found the query related to this ? Thanks. > Non-selected columns for SELECT DISTINCT allowed in ORDER BY clause if > ordered by expression > -------------------------------------------------------------------------------------------- > > Key: DERBY-4371 > URL: https://issues.apache.org/jira/browse/DERBY-4371 > Project: Derby > Issue Type: Bug > Components: SQL > Affects Versions: 10.5.1.1 > Reporter: Bernt M. Johnsen > Assignee: C.S. Nirmal J. Fernando > Priority: Critical > Attachments: DERBY-4371-2.diff, DERBY-4371.diff > > > How to repeat: > ij> create table t (i integer, j integer);; > 0 rows inserted/updated/deleted > ij> insert into t values (1,2),(1,3); > 2 rows inserted/updated/deleted > ij> select distinct i from t order by j; > ERROR 42879: The ORDER BY clause may not contain column 'J', since the query > specifies DISTINCT and that column does not appear in the query result. > ij> select distinct i from t order by j*2; > I > ----------- > 1 > 1 > 2 rows selected -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.