Issue Details (XML | Word | Printable)

Key: DERBY-2351
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Bryan Pendleton
Reporter: Yip Ng
Votes: 1
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Derby

ORDER BY with expression with distinct in the select list returns incorrect result

Created: 17/Feb/07 12:36 AM   Updated: 30/Jun/09 04:12 PM
Return to search
Component/s: SQL
Affects Version/s: 10.2.1.6, 10.2.2.0, 10.3.1.4
Fix Version/s: 10.3.3.0, 10.4.1.3, 10.5.1.1

Time Tracking:
Not Specified

File Attachments:
  Size
File Licensed for inclusion in ASF works d2351_aliasing.diff 2008-03-04 04:34 AM Bryan Pendleton 9 kB
File Licensed for inclusion in ASF works d2351_aliasing.diff 2008-03-02 10:42 PM Bryan Pendleton 7 kB
File Licensed for inclusion in ASF works d2351_aliasing_checkQualifiedName.diff 2008-03-06 04:29 AM Bryan Pendleton 11 kB
File Licensed for inclusion in ASF works derby_2351.diff 2007-06-17 03:30 AM Bryan Pendleton 9 kB
File Licensed for inclusion in ASF works derby_2351_v2.diff 2007-06-17 07:42 PM Bryan Pendleton 10 kB
File Licensed for inclusion in ASF works modifySynonymResults.diff 2008-03-08 08:45 PM Bryan Pendleton 12 kB
HTML File Licensed for inclusion in ASF works releaseNote.html 2008-04-01 01:29 PM Rick Hillegas 6 kB
HTML File Licensed for inclusion in ASF works releaseNote.html 2008-03-20 02:42 PM Bryan Pendleton 6 kB
HTML File Licensed for inclusion in ASF works releaseNote.html 2008-03-20 05:20 AM Bryan Pendleton 4 kB
File Licensed for inclusion in ASF works reproTests.diff 2007-06-10 09:45 PM Bryan Pendleton 5 kB
Environment: Any
Issue Links:
Reference

Issue & fix info: Release Note Needed
Resolution Date: 16/Mar/08 03:51 AM


 Description  « Hide
When distinct is in the select list and the query has order by with expression, the resultset produced contains an additional column.

ij> create table t1 (c1 int, c2 varchar(10))
0 rows inserted/updated/deleted
ij> insert into t1 values (1,'a'),(2,'b'),(3,'c');
3 rows inserted/updated/deleted
select distinct c1, c2 from t1 order by c1;
C1 |C2
----------------------
1 |a
2 |b
3 |c

3 rows selected
ij> select distinct c1, c2 from t1 order by c1+1;
C1 |C2 |3 <=====returns 3 columns, incorrect result returned
----------------------------------
1 |a |2
2 |b |3
3 |c |4

3 rows selected


 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
No work has yet been logged on this issue.