On 04/29/10 05:16 PM, Nirmal Fernando wrote: > Hi All, > I think behaviour of following test is not valid, since > ColumnReference age is not there in the distinct list. > line:1810 of orderby.out > > ij> -- Ordering by an expression involving an unselected column is not. > However, > -- Derby does not currently enforce this restriction. Note that the answer > -- that Derby returns is incorrect: Derby returns two rows with duplicate > -- 'name' values. This is because Derby currently implicitly includes the > -- 'age' column into the 'distinct' processing due to its presence in the > -- ORDER BY clause. DERBY-2351 and DERBY-3373 discuss this situation in > -- more detail. > select distinct name from person order by age*2; > NAME > ---------- > John > Mary > John > > Can someone explain this behaviour? >
Hi Nirmal, I think this test case only attempts to demonstrate a bug that later was logged as DERBY-4371. If you fix DERBY-4371, I find it quite reasonable to update orderby.out to reflect that the query is now rejected. -- Knut Anders
