Re: [JDBC] BigDecimal instead of Integer in 7.1

2001-04-30 Thread Joseph Shraibman

Tom Lane wrote:
> 
> Joseph Shraibman <[EMAIL PROTECTED]> writes:
> > The problem is suddenly in 7.1 the result of the subselect used to
> > return an Integer now returns a BigInteger and is causing
> > classCastExceptions in my code.  What gives?
> 
> sum() and avg() return NUMERIC now for integer input, to avoid
> overflow and precision problems.
> 
> regards, tom lane


My second count (not in the subquery) is returning an Integer.
-- 
Joseph Shraibman
[EMAIL PROTECTED]
Increase signal to noise ratio.  http://www.targabot.com

---(end of broadcast)---
TIP 6: Have you searched our list archives?

http://www.postgresql.org/search.mpl



Re: [JDBC] BigDecimal instead of Integer in 7.1

2001-04-30 Thread Tom Lane

Joseph Shraibman <[EMAIL PROTECTED]> writes:
> The problem is suddenly in 7.1 the result of the subselect used to
> return an Integer now returns a BigInteger and is causing
> classCastExceptions in my code.  What gives?

sum() and avg() return NUMERIC now for integer input, to avoid
overflow and precision problems.

regards, tom lane

---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html



[JDBC] BigDecimal instead of Integer in 7.1

2001-04-30 Thread Joseph Shraibman

I just upgraded from 7.0.3 to 7.1.

I have a query like this:
SELECT l, (SELECT COUNT(*) FROM ms WHERE ms.p = 4 AND ms.s = 2),
COUNT(DISTINCT m.uid), COUNT(m.oid), AVG(m.msgs::int), SUM(m.msgs::int)
FROM m, a WHERE key = 4 AND m.p = 4 GROUP BY l;

The problem is suddenly in 7.1 the result of the subselect used to
return an Integer now returns a BigInteger and is causing
classCastExceptions in my code.  What gives?



-- 
Joseph Shraibman
[EMAIL PROTECTED]
Increase signal to noise ratio.  http://www.targabot.com

---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster