db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig L Russell <Craig.Russ...@Sun.COM>
Subject Re: [jira] Commented: (JDO-245) JPOX must throw JDOUserException for queries specifying having clause refering fields which are not part of the result clause.
Date Thu, 05 Jan 2006 16:26:15 GMT
Hi Michael,

On Jan 5, 2006, at 7:38 AM, Michael Bouschen wrote:

> Hi Craig,
>
> [...]
>
>>> CLR: And another negative test for HAVING that uses a term that's  
>>> not an aggregate.
>>> SELECT department, AVG(weeklyhours) FROM Employee GROUP BY  
>>> department HAVING middlename != NULL
>>>
>>> MBO: OK, then we are back to the original negative query which  
>>> had a HAVING clause: HAVING firstname = 'emp1first'. But I can  
>>> add this, too.
>> Yes, please. It's a different negative test from others because  
>> it's a boolean expression (ok) using non-aggregate terms (bad).
>
> Just for my understanding: it is ok to use a non-aggregate  
> expression as long as it is a grouping expression, correct?

Yes. Here's my latest attempt at the having expression:
A14.6.10-2 [When “having” is specified, the “having” expression  
consists of arithmetic and boolean expressions containing expressions  
that are either aggregate expressions or contained in a grouping  
expression.]

Since the having expression is applied *after* the grouping is  
complete, this restriction is required. "Having" expressions without  
aggregates doesn't make sense; these expressions should be part of  
the where clause.
>
> I added a new negative test to class Having:
>   SELECT department, AVG(weeklyhours) FROM Employee
>   GROUP BY department HAVING firstname == 'emp1First'
> JPOX does not catch this error.
>
> I propose the following:
> - I check in the change with the new negative test.

ok

> - I reopen issue JDO-245.

ok

> - I really think the title of JDO-245 talking about "having clause  
> refering fields which are not part of the result clause" is  
> misleading, because the result clause does not matter here. I would  
> like to change the title.

If you can edit the JIRA please do so. I think you have karma.

> - I would like to move the test class from the result package to  
> jdoql.

ok

Regards,

Craig
>
> What do you think?
>
> Regards Michael
> -- 
> Michael Bouschen		Tech@Spree Engineering GmbH
> mailto:mbo.tech@spree.de	http://www.tech.spree.de/
> Tel.:++49/30/235 520-33		Buelowstr. 66			
> Fax.:++49/30/2175 2012		D-10783 Berlin			

Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!


Mime
View raw message