Re: Refactoring the Type System

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Daniel Farina <drfarina(at)acm(dot)org>
Cc: Jeff Davis <pgsql(at)j-davis(dot)com>, David Fetter <david(at)fetter(dot)org>, PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Refactoring the Type System
Date: 2010-11-14 15:47:43
Message-ID: 10464.1289749663@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Daniel Farina <drfarina(at)acm(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2010-11-14 16:06:51 Re: POSIX shared memory redux
Previous Message Tom Lane 2010-11-14 15:44:23 Re: [COMMITTERS] pgsql: Improved parallel make support