db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bryan Pendleton (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-3997) ORDER BY causes column to be returned
Date Tue, 30 Dec 2008 16:02:44 GMT

    [ https://issues.apache.org/jira/browse/DERBY-3997?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12659836#action_12659836
] 

Bryan Pendleton commented on DERBY-3997:
----------------------------------------

Hi Knut, the patch looks fine to me. I verified that the new test fails
without the change to SelectNode.java and passes with the change.

I also tried a few other test cases, and confirmed that their results
look reasonable. I'm not sure that they add anything all that valuable
to the patch, but for completeness here's the new cases I tried:

1) selecting an actual column from the table rather than a constant expression
2) selecting * from the table
3) selecting from the table with a WHERE clause that does NOT reduce
the ORDER BY to a a constant.

If you think they're useful enough to add to the patch, go for it, otherwise
I think you can just commit the patch as is.

Thanks again for picking this issue up!

ij> create table d3997_a(a int, b int, c int);
0 rows inserted/updated/deleted
ij> insert into d3997_a values (1,2,3);
1 row inserted/updated/deleted
ij> select a from d3997_a where b = 2 order by b;
A
-----------
1

1 row selected
ij> select * from d3997_a where b != 2 order by b;
A          |B          |C
-----------------------------------

0 rows selected
ij> select c from d3997_a where b > 1 order by b;
C
-----------
3

1 row selected


> ORDER BY causes column to be returned
> -------------------------------------
>
>                 Key: DERBY-3997
>                 URL: https://issues.apache.org/jira/browse/DERBY-3997
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.4.1.3
>         Environment: Mac OS 10.4, JDK 1,6
>            Reporter: geoff hendrey
>            Assignee: Knut Anders Hatlen
>         Attachments: d3997.diff, d3997.stat
>
>
> The ORDER BY is causing the ordered column to be retrieved even though it is not part
of the SELECT clause. Here is a script to create a table, insert a row, and perform the select:
> CREATE TABLE "REVIEWS"."GEOFF__REVIEWS__REVIEW"
> (
>    PK INTEGER PRIMARY KEY not null,
>    numstars BIGINT,
>    body VARCHAR(32672),
>    title VARCHAR(32672),
>    authoremail VARCHAR(32672)
> );
> INSERT INTO "REVIEWS"."GEOFF__REVIEWS__REVIEW" (PK,numstars,body,title,authoremail) VALUES
(0 /*not nullable*/,0,'s','s','s');
> SELECT  "review"."numstars"
> FROM
>     "GEOFF__REVIEWS__REVIEW" AS "review"
> WHERE
>         "review"."PK" = 1
> ORDER BY
>     "review".PK

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message