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 "Andrew McIntyre (JIRA)" <de...@db.apache.org> on 2006/10/07 06:50:21 UTC

[jira] Updated: (DERBY-1624) use of direct column name rather than alias make aggregation fail (Hibernate depends on that)

     [ http://issues.apache.org/jira/browse/DERBY-1624?page=all ]

Andrew McIntyre updated DERBY-1624:
-----------------------------------

    Attachment: 1624_repro.sql

While poking at this issue, I came up with a bunch of simple testcases thatI thought should all pass, but out of 18, only 7 pass, and those mostly because they were crafted to avoid this issue and demonstrate the correct results. I don't think I'll have time to work on this any time soon, but I think it demonstrates how broken the result column resolution is for columns with correlation names, especially when there is a HAVING clause (and even one rewrite to a subquery that I thought would work, but didn't).

Anyway, if anyone does pick this up anytime soon, I think the testcases provided here will be a useful guide towards getting things working. It might be useful one to pick up, as well, since it will improve Derby's usability with Hibernate.

> use of direct column name rather than alias make aggregation fail (Hibernate depends on that)
> ---------------------------------------------------------------------------------------------
>
>                 Key: DERBY-1624
>                 URL: http://issues.apache.org/jira/browse/DERBY-1624
>             Project: Derby
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 10.1.3.1, 10.1.1.0
>            Reporter: Emmanuel Bernard
>         Attachments: 1624_repro.sql
>
>
> Error: org.apache.derby.client.am.SqlException: Column 'MODEL0_.COL_0_0_' is either not in any table in the FROM list or appears within a join specification and is outside the scope of the join specification or appears in a HAVING clause and is not in the GROUP BY list. If this is a CREATE or ALTER TABLE  statement then 'MODEL0_.COL_0_0_' is not a column in the target table., SQL State: 42X04, Error Code: -1
> for
> select
>         model0_.balance as col_0_0_,
>         count(*) as col_1_0_ 
>     from
>         account model0_ 
>     group by
>         model0_.balance 
>     having
>         count(*) > 1

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