Subject Re: [firebird-support] Numeric Aggregates problem in EXECUTE STATEMENT
Author Dmitry Yemanov
"Paul Hope" <paulhope@...> wrote:
>
> I am not convinced that the documentation would lead you to expect that
> Sum(numeric(9,2)) would not match a numeric(9,2) variable.

Sorry, but typeof(value) <> typeof(sum(value)). Sum(numeric(9,2)) produces
int64 with scale=2. If you assign this back to numeric(9,2), you risk to
overflow. It has very little to do with PSQL or EXECUTE STATEMENT.

> IMO its natural to expect EXECUTE
> STATEMENT to be equivalent to using the statement itself.

I won't be arguing much, as I partially agree. But EXECUTE STATEMENT is more
dangerous as the PSQL compiler doesn't check what you have coded, so
Firebird tries to make sure you know what you're doing and e.g. the
aforementioned loss of precision is not a programming mistake.


Dmitry