Thomas, Did you see my repro steps for a similar but simpler problem? I think Taras's issue is a manifestation of a deeper problem: if a SELECT statement with a GROUP BY clause results in just one row, then you can erroneously include columns in the SELECT column list that are not in the GROUP BY column list, without H2 complaining.
I'd have a go at fixing this myself, but I'm out of my depth with this one... On Friday, 28 August 2015 17:51:35 UTC+2, Thomas Mueller wrote: > > Hi, > > I think I will remove the feature to use column alias in "having". That > would be in line with PostgreSQL, and avoid discussions like this. > > > a) its not clear why #4 failed but #2 was ok. > > Actually, #2 was not OK either, it's unfortunate that it doesn't result in > an exception. > > > b) Error description is step#4 is not helpful and correct. If I add > 'time' to GROUP BY, query still fails. > > Yes, the error message is misleading. I don't know what the error message > should be here. > > > c) Please add documentation about H2 support of column aliases in > "HAVING" > > If I remove the feature, then documenting it is much simpler. > > Regards, > Thomas > > > On Fri, Aug 28, 2015 at 10:37 AM, Taras Fedkiv <[email protected]> wrote: > >> Hi Thomas, >> Could you please answer the questions from previous email? >> My API allows clients to enter SELECT queries which are executed on H2 >> db. Thats why logical H2 behaviur is very important. >> >> I look forward to your reply, >> Taras >> >> The information in this message may be confidential. It is intended >> solely for >> the addressee(s). If you are not the intended recipient, any disclosure, >> copying or distribution of the message, or any action or omission taken >> by you >> in reliance on it, is prohibited and may be unlawful. Please immediately >> contact the sender if you have received this message in error. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "H2 Database" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at http://groups.google.com/group/h2-database. >> For more options, visit https://groups.google.com/d/optout. >> > > -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/h2-database. For more options, visit https://groups.google.com/d/optout.
