db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geoff hendrey <geoff_hend...@yahoo.com>
Subject Re: why is column being returned?
Date Wed, 24 Dec 2008 06:01:02 GMT
Hi Bryan,

This bug snuck up and bit me again...Per your suggestion, here is a reproducible script:
(your original email is at the bottom. I will log a Jira issue would be created as this bug
keeps coming back to haunt me)

 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 





________________________________
From: Bryan Pendleton <bpendleton@amberpoint.com>
To: Derby Discussion <derby-user@db.apache.org>
Sent: Wednesday, July 2, 2008 5:53:12 PM
Subject: Re: why is column being returned?

Geoff hendrey wrote:
> Hi,
> 
> I am doing something like:
> 
> SELECT
>     "A"."C1" AS "A.C1",
>     "A"."C2" AS "A.C2"
> FROM
>     ATABLE AS "A"
> WHERE
>     "A"."C1" = "X"
> ORDER BY
>     PK
> 
> Does it make sense that PK should be returned in the result set? I expected ONLY "A.C1"
and "A.C2" to be the column names returned by JDBC...but I see "PK" as well. It may be a bug
in my code somewhere else, or is it possible that the ORDER BY is forcing "PK" to be returned?

I think that it *is* due to the ORDER BY, and I think that it is
incorrect behavior. I noticed this myself a while back and tried
to pin it down, but I was having trouble isolating a standalone
reproducible test case.

If you can construct a simple standalone test program which demonstrates
this behavior, I think it would be great if you could log it into JIRA
so we can track it and study it more.

thanks,

bryan
Mime
View raw message