Re: money type's overflow handling is woefully incomplete

From: Andres Freund <andres(at)anarazel(dot)de>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: money type's overflow handling is woefully incomplete
Date: 2017-12-12 23:30:29
Message-ID: 20171212233029.dv4qzawxocyrr5wq@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2017-12-13 08:27:42 +0900, Michael Paquier wrote:
> On Wed, Dec 13, 2017 at 6:50 AM, Andres Freund <andres(at)anarazel(dot)de> wrote:
> > On 2017-12-12 16:47:17 -0500, Tom Lane wrote:
> >> Really? We've got test cases that intentionally exercise overflow
> >> in the money code? I think we could just drop such tests, until
> >> such time as someone fixes the issue.
> >
> > Some parts at least (input & output), I think it's easy enough to fix
> > those up.
>
> There could be two ways to fix that:
> 1) Call the int8 equivalents with DirectFunctionCall2 and rely on the
> overflow there, but this has a performance impact.
> 2) Add similar checks as in int8.c, which feels like duplicating code
> but those are cheap.
> You are heading to 2) I guess?

I don't think 1) makes much sense. The error messages will be bad, and
the harder cases (e.g. cash_in()) can't share code anyway.

> >> (OTOH, I bet we could drop reltime/abstime without too many complaints.
> >> Y2038 is coming.)
> >
> > I'm actually about to send a patch doing so, that code is one mess WRT
> > overflow handling.
>
> Agreed. I think as well that those should be fixed. It does not seem
> much complicated to fix them.

I'm not following. I was trying to say that I'll send a patch removing
the abstime/reltime/tinterval code.

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Steele 2017-12-12 23:30:47 Re: PATCH: Exclude unlogged tables from base backups
Previous Message Michael Paquier 2017-12-12 23:27:42 Re: money type's overflow handling is woefully incomplete