Re: Re: [BUGS][PATCH] BUG #14486: Inserting and selecting interval have different constraints

From: Vitaly Burovoy <vitaly(dot)burovoy(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Pantelis Theodosiou <ypercube(at)gmail(dot)com>, web+postgresql(at)modin(dot)io, pgsql-bugs(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Re: [BUGS][PATCH] BUG #14486: Inserting and selecting interval have different constraints
Date: 2017-01-05 17:06:11
Message-ID: CAKOSWNmxbjrfLqCujA1oDwQo5EEM5+ptzzQGpjjrhgCY1zq+bw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On 1/5/17, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Vitaly Burovoy <vitaly(dot)burovoy(at)gmail(dot)com> writes:
>>> I've written a patch which fixes that bug (in attachment).
>>> Should it be registered in the CF?
>
>> Oops. Forgot to attach the patch. Fixed.
>
> I suspect that many of these SAMESIGN() tests you've added are not
> actually adequate/useful. That's only sufficient when the output could be
> at most a factor of 2 out-of-range. If it could overflow past the sign
> bit then you need to work harder.

I disagree. These SAMESIGN() tests cover addition where result can not
be more than one out-of-range.
Multiplications are covered just before.

> (By the same token, the existing SAMESIGN test in interval2tm is
> wrong.)
>
> Possibly we should consider alternatives before plowing ahead in this
> direction, since adding guards to interval_in and interval computations
> doesn't help with oversize values that are already stored in a database.

We can do nothing with values are already stored in a database. But we
can prevent appearing them later.

> We could think about replacing interval2tm's output format with some
> other struct that uses a TimeOffset for hours and so cannot overflow.
> I'm not sure though how far the effects would propagate; it might be
> more work than we want to put into this.

If values with overflow are already in a database, what do you expect
a new output function should fix?

--
Best regards,
Vitaly Burovoy

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2017-01-05 17:11:36 Re: Re: [BUGS][PATCH] BUG #14486: Inserting and selecting interval have different constraints
Previous Message Tom Lane 2017-01-05 16:48:27 Re: [HACKERS] Re: [PATCH] BUG #14486: Inserting and selecting interval have different constraints

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2017-01-05 17:08:36 Re: Replication/backup defaults
Previous Message Robert Haas 2017-01-05 17:03:06 Re: merging some features from plpgsql2 project