On Sybase ASE, avg() function returns a value in the type of the parameters

Description

JPA specification ask avg() should return Double.

In Reference Manual:
When you average (signed or unsigned) int, smallint, tinyint data, Adaptive Server returns the result as an int value.

But considering it as an ASE feature, it won't be fixed.

Environment

Hibernate 3.6.6, Sybase ASE15.5, JDK 1.6, Windows XP

Activity

Show:
Strong Liu
July 11, 2011, 10:28 AM

for example:

ID

VALUE

1

1

2

2

Double avgValue = (Double)session.createQuery("select avg(t.value) from Table t").uniqueResult();

mysql : avgValue == 1.5
sybase : avgValue == 1

Brett Meyer
March 7, 2014, 5:31 PM

Bulk closing rejected tickets in "resolved" state.

Assignee

Strong Liu

Reporter

Ren Junyan

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Affects versions

Priority

Minor
Configure