db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Satheesh Bandaram <sathe...@Sourcery.Org>
Subject Re: [jira] Updated: (DERBY-466) Distinct in subselect can return wrong results
Date Sat, 23 Jul 2005 00:39:39 GMT
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  <meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
<body bgcolor="#ffffff" text="#000000">
This patch has been committed. Thanks for getting involved with Derby!!!<br>
Transmitting file data ...<br>
Committed revision 224427.<br>
Manish Khettry (JIRA) wrote:<br>
  <pre wrap="">     [ <a class="moz-txt-link-freetext" href="http://issues.apache.org/jira/browse/DERBY-466?page=all">http://issues.apache.org/jira/browse/DERBY-466?page=all</a>

Manish Khettry updated DERBY-466:

    Attachment: distinct.diff.txt

I have attached the diff file for this bugfix for review. Ran derbylang.

  <blockquote type="cite">
    <pre wrap="">Distinct in subselect can return wrong results

         Key: DERBY-466
         URL: <a class="moz-txt-link-freetext" href="http://issues.apache.org/jira/browse/DERBY-466">http://issues.apache.org/jira/browse/DERBY-466</a>
     Project: Derby
        Type: Bug
  Components: SQL
 Environment: All Platforms
    Reporter: Manish Khettry
    Assignee: Manish Khettry
 Attachments: distinct.diff.txt

The second query should return two rows but returns just one.
ij&gt; select * from t1;
I          |V         
1          |row 1     
2          |row 2     
2 rows selected
ij&gt; select * from t1, (select distinct 1 from t1) as sub(c);
I          |V         |C          
1          |row 1     |1          
1 row selected
More specifically, this bug will show up when the sql layer does duplication elimination for
distinct *without* a sorter (i.e. the underlying result set is already sorted). The result
set will return correct data the first time, but after it is closed and re-opened it will
not return any data rows.
  <pre wrap=""><!---->

View raw message