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 [EMAIL PROTECTED] Engineering GmbH
mailto:[EMAIL PROTECTED] 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:[EMAIL PROTECTED]

P.S. A good JDO? O, Gasp!


Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to