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 "Knut Anders Hatlen (JIRA)" <ji...@apache.org> on 2008/12/24 23:34:44 UTC

[jira] Commented: (DERBY-3997) ORDER BY causes column to be returned

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

Knut Anders Hatlen commented on DERBY-3997:
-------------------------------------------

I managed to reproduce it with an even simpler script:

ij> create table t (x int primary key, y int);
0 rows inserted/updated/deleted
ij> select y from t where x = 1 order by x;
Y          |X          
-----------------------

0 rows selected

Remove the WHERE clause or the ORDER BY clause, and the column X disappears.

> 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
>
> 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.