Default numeric scale of zero in JDBC?

Поиск
Список
Период
Сортировка
От Todd Shoemaker
Тема Default numeric scale of zero in JDBC?
Дата
Msg-id 20070118140542.61505.qmail@web53601.mail.yahoo.com
обсуждение исходный текст
Список pgsql-jdbc
Hello,

I have discovered that the jdbc driver apparently uses a default scale of zero decimal places for SQL numeric
operators,including the sum() aggregate operator.  For example, this query: 

select (1.5 + 2);

This returns 4 from jdbc, but it returns 3.5 when run from within PGAdmin.  The only way I can coerce the value to
returndecimal places is to explicity cast the value to a numeric with scale: 

select cast(1.5 + 2 as numeric(10,2)) as value

This returns 3.5.

Also, queries like "select sum(value) from table" returns a rounded value, even though the column 'value' is
numeric(16,2). Is there a magic vmparam or setting to default the precision at the jdbc driver level?  I am trying to
runa large existing system on PostgreSQL and it is not feasible to hunt down all numeric operations in thousands of
classesto explicitly cast them.   Have others have encountered this issue? 

Thanks,

-Todd






В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Dave Cramer
Дата:
Сообщение: Re: Memory leaks using refcursors
Следующее
От: "Guillaume Smet"
Дата:
Сообщение: Re: Memory leaks using refcursors