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 Nirmal Fernando <ni...@gmail.com> on 2010/04/29 17:16:08 UTC

Test case in orderby.out file

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?

Thanks.

--
Best Regards,
Nirmal

C.S.Nirmal J. Fernando
Department of Computer Science & Engineering,
Faculty of Engineering,
University of Moratuwa,
Sri Lanka.

Re: Test case in orderby.out file

Posted by Nirmal Fernando <ni...@gmail.com>.
Hi Knut,

Thanks for the reply.

On Thu, Apr 29, 2010 at 11:53 PM, Knut Anders Hatlen
<Kn...@sun.com> wrote:
> 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
>
>



-- 
Best Regards,
Nirmal

C.S.Nirmal J. Fernando
Department of Computer Science & Engineering,
Faculty of Engineering,
University of Moratuwa,
Sri Lanka.

Re: Test case in orderby.out file

Posted by Knut Anders Hatlen <Kn...@Sun.COM>.
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