dbTalk Databases Forums  

[Info-Ingres] default type of a sum()

comp.databases.ingres comp.databases.ingres


Discuss [Info-Ingres] default type of a sum() in the comp.databases.ingres forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Martin Bowes
 
Posts: n/a

Default [Info-Ingres] default type of a sum() - 02-20-2009 , 07:02 AM






Hi All,

In Ingres2.6 the sum() operation on a set of integers always returned an
int4 item...which was cool for the java applications we have written.

Since upgrading to Ingres2006, we now see that the sum() returns an int8
item. This is unfortunate as it doesn't need to and our java apps throw
an cast exception error as the fields are returned as a Java Long (long
integer) type instead of an Integer (regular integer) type that the code
expects.

The values being summed never need to be stored as a long int (they are
never big enough).

The query could be rewritten to explictly convert the result of the
calculation to an int4 (i.e. select int4(sum(field) as ...). However
that would mean rewriting quite a lot of SQL hence a degree of risk.

Is there some configuration parameter (DBMS or per-database) that could
force the default type of sum() (and other aggregates) to be integer4?

Martin Bowes


Reply With Quote
  #2  
Old   
Karl & Betty Schendel
 
Posts: n/a

Default Re: [Info-Ingres] default type of a sum() - 02-20-2009 , 09:39 AM







On Feb 20, 2009, at 8:02 AM, Martin Bowes wrote:

Quote:
Is there some configuration parameter (DBMS or per-database) that
could
force the default type of sum() (and other aggregates) to be integer4?
Nope. If the client side is 2.6 or older, a coercion is applied
to some i8 items to make them i4; I know it happens with tids, and
I think sum() would qualify as well. However in the jdbc situation,
the dbms server client is the DAS server, which is up to date.
So the down-coercion wouldn't apply.

Karl



Reply With Quote
  #3  
Old   
Martin Bowes
 
Posts: n/a

Default Re: [Info-Ingres] default type of a sum() - 02-20-2009 , 09:48 AM



Thanks Karl,

Marty

-----Original Message-----
From: info-ingres-bounces (AT) kettleriver...ting (DOT) com
[mailto:info-ingres-bounces (AT) kettleriverconsulting (DOT) com] On Behalf Of Karl
& Betty Schendel
Sent: 20 February 2009 15:39
To: Ingres and related product discussion forum
Subject: Re: [Info-Ingres] default type of a sum()


On Feb 20, 2009, at 8:02 AM, Martin Bowes wrote:

Quote:
Is there some configuration parameter (DBMS or per-database) that
could
force the default type of sum() (and other aggregates) to be integer4?
Nope. If the client side is 2.6 or older, a coercion is applied
to some i8 items to make them i4; I know it happens with tids, and
I think sum() would qualify as well. However in the jdbc situation,
the dbms server client is the DAS server, which is up to date.
So the down-coercion wouldn't apply.

Karl

_______________________________________________
Info-Ingres mailing list
Info-Ingres (AT) kettleriverconsulting (DOT) com
http://www.kettleriverconsulting.com...fo/info-ingres



Reply With Quote
  #4  
Old   
Kristoff
 
Posts: n/a

Default Re: default type of a sum() - 03-02-2009 , 02:24 AM



Hi Marty,
there was a similar problem for some ODBC applications. In ODBC there
is now a connection flag available which forces the conversion from
all int8 to int4 in the Driver. Not sure whether we can add this to
the JDBC driver too, but you can open an issue and we will check. Keep
in mind that if this conversion is place you can not retrieve "real"
int8 values in this session.

Kristoff

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.