Subject [firebird-support] Re: update statement Excel Sheet
Author Svein Erling Tysvær
>after the update i got a problem with the application.... the error msg is
>
>General SQL erroe.
>Invalid expression in the HAVING clause (nither an aggregate function nor a part of the GROUP BY clause).
>I think I need to update the the UDF or LIB maybe
>
>the application was working great with the FB ver. 1.0 but when I update to 2.5 I got this message.
>any advice?
>
>I have to applications (delphi) only one of them is giving the error and the other is great.

Hi Ahmad!

I don't think this error has anything to do with UDFs or similar, it is more likely poorly written SQL within the application. Firebird 2.5 is stricter regarding the SQL than Firebird 1.0 was. The particular error you observed can be experienced when you do refer to a variable neither in the output set nor an aggregate function in your HAVING clause. E.g. (using RDB$DATABASE in this example, it exists in all Firebird databases, so you can test the SQL on your database)

select RDB$DESCRIPTION
from RDB$DATABASE
group by RDB$DESCRIPTION
having RDB$RELATION_ID > 0

This is incorrect SQL (RDB$RELATION_ID is not part of the grouped result, since I don't have Fb 1.0 here, I don't know whether that version would have allowed this or not) and should be replaced by

select RDB$DESCRIPTION
from rdb$database
where RDB$RELATION_ID > 0
group by RDB$DESCRIPTION

You may discover other differences as well and thorough testing of your applications are recommended when upgrading from 1.0 to 2.5 (of course, how thorough aren't the same for applications used in nuclear power plants and for applications to keep track of birthdays within a family).

HTH,
Set