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 "Manish Khettry (JIRA)" <de...@db.apache.org> on 2005/07/20 02:30:47 UTC

[jira] Created: (DERBY-466) Distinct in subselect can return wrong results

Distinct in subselect can return wrong results
----------------------------------------------

         Key: DERBY-466
         URL: http://issues.apache.org/jira/browse/DERBY-466
     Project: Derby
        Type: Bug
  Components: SQL  
 Environment: All Platforms
    Reporter: Manish Khettry


The second query should return two rows but returns just one.

ij> select * from t1;
I          |V         
----------------------
1          |row 1     
2          |row 2     

2 rows selected
ij> 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.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Assigned: (DERBY-466) Distinct in subselect can return wrong results

Posted by "Manish Khettry (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-466?page=all ]

Manish Khettry reassigned DERBY-466:
------------------------------------

    Assign To: Manish Khettry

> Distinct in subselect can return wrong results
> ----------------------------------------------
>
>          Key: DERBY-466
>          URL: http://issues.apache.org/jira/browse/DERBY-466
>      Project: Derby
>         Type: Bug
>   Components: SQL
>  Environment: All Platforms
>     Reporter: Manish Khettry
>     Assignee: Manish Khettry

>
> The second query should return two rows but returns just one.
> ij> select * from t1;
> I          |V         
> ----------------------
> 1          |row 1     
> 2          |row 2     
> 2 rows selected
> ij> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (DERBY-466) Distinct in subselect can return wrong results

Posted by "Manish Khettry (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-466?page=all ]

Manish Khettry updated DERBY-466:
---------------------------------

    Attachment: distinct.diff.txt

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

> Distinct in subselect can return wrong results
> ----------------------------------------------
>
>          Key: DERBY-466
>          URL: http://issues.apache.org/jira/browse/DERBY-466
>      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> select * from t1;
> I          |V         
> ----------------------
> 1          |row 1     
> 2          |row 2     
> 2 rows selected
> ij> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Closed: (DERBY-466) Distinct in subselect can return wrong results

Posted by "Andrew McIntyre (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-466?page=all ]
     
Andrew McIntyre closed DERBY-466:
---------------------------------

    Resolution: Fixed

> Distinct in subselect can return wrong results
> ----------------------------------------------
>
>          Key: DERBY-466
>          URL: http://issues.apache.org/jira/browse/DERBY-466
>      Project: Derby
>         Type: Bug

>   Components: SQL
>  Environment: All Platforms
>     Reporter: Manish Khettry
>     Assignee: Manish Khettry
>      Fix For: 10.2.0.0, 10.1.3.0, 10.1.2.2
>  Attachments: d466-10_1.patch, distinct.diff.txt
>
> The second query should return two rows but returns just one.
> ij> select * from t1;
> I          |V         
> ----------------------
> 1          |row 1     
> 2          |row 2     
> 2 rows selected
> ij> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Closed: (DERBY-466) Distinct in subselect can return wrong results

Posted by "Satheesh Bandaram (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-466?page=all ]
     
Satheesh Bandaram closed DERBY-466:
-----------------------------------


Confirmed the fix addresses the problem being reported. Thanks Manish!

> Distinct in subselect can return wrong results
> ----------------------------------------------
>
>          Key: DERBY-466
>          URL: http://issues.apache.org/jira/browse/DERBY-466
>      Project: Derby
>         Type: Bug
>   Components: SQL
>  Environment: All Platforms
>     Reporter: Manish Khettry
>     Assignee: Manish Khettry
>      Fix For: 10.2.0.0
>  Attachments: distinct.diff.txt
>
> The second query should return two rows but returns just one.
> ij> select * from t1;
> I          |V         
> ----------------------
> 1          |row 1     
> 2          |row 2     
> 2 rows selected
> ij> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Resolved: (DERBY-466) Distinct in subselect can return wrong results

Posted by "Kathey Marsden (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-466?page=all ]
     
Kathey Marsden resolved DERBY-466:
----------------------------------

    Fix Version: 10.1.3.0
                 10.1.2.2
     Resolution: Fixed

Checked in fix to 10.1 with SVN  SVN 348033 


> Distinct in subselect can return wrong results
> ----------------------------------------------
>
>          Key: DERBY-466
>          URL: http://issues.apache.org/jira/browse/DERBY-466
>      Project: Derby
>         Type: Bug
>   Components: SQL
>  Environment: All Platforms
>     Reporter: Manish Khettry
>     Assignee: Manish Khettry
>      Fix For: 10.2.0.0, 10.1.3.0, 10.1.2.2
>  Attachments: d466-10_1.patch, distinct.diff.txt
>
> The second query should return two rows but returns just one.
> ij> select * from t1;
> I          |V         
> ----------------------
> 1          |row 1     
> 2          |row 2     
> 2 rows selected
> ij> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Reopened: (DERBY-466) Distinct in subselect can return wrong results

Posted by "Andrew McIntyre (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-466?page=all ]
     
Andrew McIntyre reopened DERBY-466:
-----------------------------------


> Distinct in subselect can return wrong results
> ----------------------------------------------
>
>          Key: DERBY-466
>          URL: http://issues.apache.org/jira/browse/DERBY-466
>      Project: Derby
>         Type: Bug

>   Components: SQL
>  Environment: All Platforms
>     Reporter: Manish Khettry
>     Assignee: Manish Khettry
>      Fix For: 10.2.0.0, 10.1.3.0, 10.1.2.2
>  Attachments: d466-10_1.patch, distinct.diff.txt
>
> The second query should return two rows but returns just one.
> ij> select * from t1;
> I          |V         
> ----------------------
> 1          |row 1     
> 2          |row 2     
> 2 rows selected
> ij> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DERBY-466) Distinct in subselect can return wrong results

Posted by "Kathey Marsden (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-466?page=comments#action_12358211 ] 

Kathey Marsden commented on DERBY-466:
--------------------------------------

Checked this into 10.1

Date: Mon Nov 21 15:53:40 2005
New Revision: 348033

URL: http://svn.apache.org/viewcvs?rev=348033&view=rev

> Distinct in subselect can return wrong results
> ----------------------------------------------
>
>          Key: DERBY-466
>          URL: http://issues.apache.org/jira/browse/DERBY-466
>      Project: Derby
>         Type: Bug
>   Components: SQL
>  Environment: All Platforms
>     Reporter: Manish Khettry
>     Assignee: Manish Khettry
>      Fix For: 10.2.0.0
>  Attachments: d466-10_1.patch, distinct.diff.txt
>
> The second query should return two rows but returns just one.
> ij> select * from t1;
> I          |V         
> ----------------------
> 1          |row 1     
> 2          |row 2     
> 2 rows selected
> ij> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Reopened: (DERBY-466) Distinct in subselect can return wrong results

Posted by "A B (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-466?page=all ]
     
A B reopened DERBY-466:
-----------------------


I would like to port this change to 10.1 and am currently working to do the merge and run the nightlies.  If the tests pass tonight then I will post the merge command tomorrow.  In the meantime, I am reopening the issue...

> Distinct in subselect can return wrong results
> ----------------------------------------------
>
>          Key: DERBY-466
>          URL: http://issues.apache.org/jira/browse/DERBY-466
>      Project: Derby
>         Type: Bug
>   Components: SQL
>  Environment: All Platforms
>     Reporter: Manish Khettry
>     Assignee: Manish Khettry
>      Fix For: 10.2.0.0
>  Attachments: distinct.diff.txt
>
> The second query should return two rows but returns just one.
> ij> select * from t1;
> I          |V         
> ----------------------
> 1          |row 1     
> 2          |row 2     
> 2 rows selected
> ij> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (DERBY-466) Distinct in subselect can return wrong results

Posted by "A B (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-466?page=all ]

A B updated DERBY-466:
----------------------

    Attachment: d466-10_1.patch

Since the old patch was applied against the "incubator" URL, a direct merge command to 10.1 was not possible.  So I've recreated the patch against the 10.1 branch (d466-10_1.patch) and am attaching it here.  I ran derbyall with Sun 1.4.2 and had no failures.

> Distinct in subselect can return wrong results
> ----------------------------------------------
>
>          Key: DERBY-466
>          URL: http://issues.apache.org/jira/browse/DERBY-466
>      Project: Derby
>         Type: Bug
>   Components: SQL
>  Environment: All Platforms
>     Reporter: Manish Khettry
>     Assignee: Manish Khettry
>      Fix For: 10.2.0.0
>  Attachments: d466-10_1.patch, distinct.diff.txt
>
> The second query should return two rows but returns just one.
> ij> select * from t1;
> I          |V         
> ----------------------
> 1          |row 1     
> 2          |row 2     
> 2 rows selected
> ij> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Closed: (DERBY-466) Distinct in subselect can return wrong results

Posted by "Kathey Marsden (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-466?page=all ]
     
Kathey Marsden closed DERBY-466:
--------------------------------


closing this issue after port to 10.1

> Distinct in subselect can return wrong results
> ----------------------------------------------
>
>          Key: DERBY-466
>          URL: http://issues.apache.org/jira/browse/DERBY-466
>      Project: Derby
>         Type: Bug
>   Components: SQL
>  Environment: All Platforms
>     Reporter: Manish Khettry
>     Assignee: Manish Khettry
>      Fix For: 10.2.0.0, 10.1.3.0, 10.1.2.2
>  Attachments: d466-10_1.patch, distinct.diff.txt
>
> The second query should return two rows but returns just one.
> ij> select * from t1;
> I          |V         
> ----------------------
> 1          |row 1     
> 2          |row 2     
> 2 rows selected
> ij> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Resolved: (DERBY-466) Distinct in subselect can return wrong results

Posted by "Satheesh Bandaram (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-466?page=all ]
     
Satheesh Bandaram resolved DERBY-466:
-------------------------------------

    Fix Version: 10.2.0.0
     Resolution: Fixed

I submitted Manish's fix to trunk sometime ago. Just marking it as Resolved.

> Distinct in subselect can return wrong results
> ----------------------------------------------
>
>          Key: DERBY-466
>          URL: http://issues.apache.org/jira/browse/DERBY-466
>      Project: Derby
>         Type: Bug
>   Components: SQL
>  Environment: All Platforms
>     Reporter: Manish Khettry
>     Assignee: Manish Khettry
>      Fix For: 10.2.0.0
>  Attachments: distinct.diff.txt
>
> The second query should return two rows but returns just one.
> ij> select * from t1;
> I          |V         
> ----------------------
> 1          |row 1     
> 2          |row 2     
> 2 rows selected
> ij> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira