Re: Refactoring the Type System - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Refactoring the Type System
Date
Msg-id 10464.1289749663@sss.pgh.pa.us
Whole thread Raw
In response to Re: Refactoring the Type System  (Daniel Farina <drfarina@acm.org>)
Responses Re: Refactoring the Type System
List pgsql-hackers
Daniel Farina <drfarina@acm.org> writes:
> Here are some weaknesses in the SUM aggregate that run up against the
> type system. Maybe they'll help crystallize some discussion:

> SUM(int2) => int4
> SUM(int4) => int8
> SUM(int8) => numeric

> Some weaknesses:

> SUM, of any precision, assumes that the precision being accumulated
> into (which is also the return-precision) is enough to avoid overflow.

This is not a flaw of the type system, it's just an implementation
choice in the SUM() aggregates.  We could easily have chosen wider
accumulation and/or result types.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [COMMITTERS] pgsql: Improved parallel make support
Next
From: Tom Lane
Date:
Subject: Re: POSIX shared memory redux