Release notes for re-motion version 1.13.152

List of Issues

Bugfixes

Details

[RM-4870] SQL Backend: The Average query operator expects a double value to be returned from the database, but the generated SQL returns an integer

Component/s: Data.Linq
Issue Type: Bug
Resolution: Fixed
Status: Closed


Sample query:

Orders.Average (o => o.OrderNumber)

If OrderNumber is of type int or long, the Average query operator method should return a double value (as the average value might not be a cardinal number). However, re-linq simply generates the following SQL:

SELECT AVG([t0].[OrderNo]) FROM [Order] [t0]

This is wrong because SQL's AVG returns an integer if the expression passed to it is of integer type.

This should be changed to emit the following SQL:

SELECT AVG(CONVERT (REAL, [t0].[OrderNo])) FROM [Order] [t0]