I recently uncovered a somewhat subtle bug in the
DB2Dialect.  When running a limit query that does a
distinct, it was applying the distinct incorrectly. 
The distinct was being placed at the beginning of the
query.   Unfortunately, this means that the distinct
was being applied to the rownumber() as well.  Since
rownumber() always returns a unique value for each
result of the query, the net result was the that the
intended distinct was not having any affect.  I fixed
this in by adding yet another nested select, and
applying the distinct to this.  We spent a good bit of
time trying to see if there was another solution that
didn't involve yet another subselect, but there didn't
seem to be.  In any event, this modification did have
desired effect of return correctly distinct results
when a limit query is performed.  I also created a
testcase which I am attaching as well.

If it would be better, I could add this bug in JIRA,
but since I am submitting a fix I wasn't sure this was
necessary.

--Chris Nelson


                
__________________________________
Do you Yahoo!?
Yahoo! Mail - You care about security. So do we.
http://promotions.yahoo.com/new_mail

Attachment: DB2Dialect.java
Description: DB2Dialect.java

Attachment: DB2DialectTest.java
Description: DB2DialectTest.java

Reply via email to