db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Francois Orsini <francois.ors...@gmail.com>
Subject Re: [jira] Commented: (DERBY-280) Wrong result from select when aliasing to same name as used in group by
Date Wed, 30 Nov 2005 19:48:20 GMT
There was a reported of a possible NPE in a particular code path and
condition which Satheesh identified - I remember Rick fixing it and
re-running the tests...

On 11/30/05, Kathey Marsden (JIRA) <derby-dev@db.apache.org> wrote:
>
>     [
> http://issues.apache.org/jira/browse/DERBY-280?page=comments#action_12358945]
>
> Kathey Marsden commented on DERBY-280:
> --------------------------------------
>
> In an earlier comment you mentioned a valid query which worked before the
> patch which now fails with:
>
> ij> select a+1 as a, a+1 as a from bug280 group by a;
> ERROR X0A00: The select list mentions column 'A' twice. This is not
> allowed in queries with GROUP BY or HAVING clauses. Try aliasing one of the
> conflicting columns to a unique name.
>
>
> There was a discussion of whether this new failure was worth introducing
> given the seriousness of returning wrong results.   A choice of the lesser
> of evils I thought, regress an edge case rather than return wrong results.
> But I might have been mistaken.
>
>
>
>
> > Wrong result from select when aliasing to same name as used in group by
> > -----------------------------------------------------------------------
> >
> >          Key: DERBY-280
> >          URL: http://issues.apache.org/jira/browse/DERBY-280
> >      Project: Derby
> >         Type: Bug
> >   Components: SQL
> >     Reporter: Bernt M. Johnsen
> >     Assignee: Rick Hillegas
> >     Priority: Minor
> >  Attachments: bug280.diff
> >
> > Wrong result from select when aliasing to same name as used in group by.
> Example:
> > If we have the following table:
> >     ij> select * from tt;
> >     I          |J
> >     -----------------------
> >     1          |2
> >     2          |3
> >     1          |2
> >     2          |3
> >     2          |3
> >
> >     5 rows selected
> > The following select is ok:
> >     ij> select i, count(*) as cnt from tt group by i;
> >     I          |CNT
> >     -----------------------
> >     1          |2
> >     2          |3
> >
> >     2 rows selected
> > But this one returns wrong result in the aliased column:
> >     ij> select i, count(*) as i from tt group by i;
> >     I          |I
> >     -----------------------
> >     1          |1
> >     2          |2
> >
> >     2 rows selected
> >
>
> --
> 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
>
>

Mime
View raw message