From: Vitaly Burovoy <vitaly.burovoy@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Pantelis Theodosiou <ypercube@gmail.com>
Cc: web+postgresql@modin.io
Cc: pgsql-bugs@postgresql.org
Cc: pgsql-hackers@postgresql.org
Subject: Re: Re: [BUGS][PATCH] BUG #14486: Inserting and selecting interval have different constraints
Date: Thu, 5 Jan 2017 18:39:09 -0800
Message-ID: <CAKOSWNmbHDUnYjW__5bO3hCqdSW+QoDZKPDA6wrnde3X27RYVA@mail.gmail.com> (raw)
In-Reply-To: <15458.1483652374@sss.pgh.pa.us>
References: <20170104150301.10134.9126@wrigleys.postgresql.org>
<CAE3TBxzkGbTt7YEfZOJfCuOv21ZKaPZ2_=Nxe65m8Xc_oQn-rg@mail.gmail.com>
<CAKOSWNmn9Kqq8wC0kjG6uh9jMV6WEAXtSVPd8pVCacTDg4yJ4A@mail.gmail.com>
<CAKOSWNnhovGBeQfe9N-L09WW++zaZtg7p_2fq3MpTfUkqDinAA@mail.gmail.com>
<5118.1483634907@sss.pgh.pa.us>
<CAKOSWNmxbjrfLqCujA1oDwQo5EEM5+ptzzQGpjjrhgCY1zq+bw@mail.gmail.com>
<6048.1483636296@sss.pgh.pa.us>
<CAKOSWN=69W8Lewi947zp0doTo=V85+rSspbDeiSxvTKOzYMxoA@mail.gmail.com>
<15458.1483652374@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
On 1/5/17, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Vitaly Burovoy <vitaly.burovoy@gmail.com> writes:
>> On 1/5/17, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>>> My point is that ideally, any value that can physically fit into struct
>>> Interval ought to be considered valid. The fact that interval_out can't
>>> cope is a bug in interval_out, which ideally we would fix without
>>> artificially restricting the range of the datatype.
>
>> Am I correct that we are still limited by ECPG which is limited by the
>> system "tm" struct?
>
> I'm not really that concerned about whether ECPG can deal with enormous
> intervals. If it bothers you, and you want to go fix it, more power to
> you --- but I think fixing the backend is much higher priority.
I really do not think it is possible since it uses system struct.
My point - ECPG is a part of Postgres, we can't fix server side and
leave the rest.
>> Also users who use a binary protocol can also use the "tm" struct and
>> can not expect overflow.
>
> If they store an enormous interval value, its really up to them not to
> choke on it when they read it back. Not our problem.
Those who store and those who read it back can be different groups of people.
For example, the second group are libraries' writers.
My point - that interval is big enough and limiting it can help people
from errors.
Because finally
* either they have an error in their data and that change will not
break their reslut (since it is wrong because of wrong source data)
* or they still get overflow and they have to find a solution - with
that patch or without it
* or they get result in that 16% interval between fitting hours into
"int" and "seconds" in PG_INT64, get silently corrupted result because
of ECPG or a library.
A solution for the third case can be the same as for the second one
because these groups can be the same (just with different data).
>> The docs say[1] the highest value of the interval type is 178_000_000
>> years which is
>
> ... irrelevant really. That's talking about the largest possible value of
> the "months" field, viz (2^31-1)/12. Perhaps we ought to document the
> other field limits, but right now there's nothing there about how large
> the hours field can get.
No, it was bad explanation of a point - now there is nothing
documented about "seconds" part of the "interval" type.
And we can just declare limit. Users don't mind reason of limitation,
they just will plan workaround if their data do not fit in limits
whatever they are.
--
Best regards,
Vitaly Burovoy
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: vitaly.burovoy@gmail.com, tgl@sss.pgh.pa.us, ypercube@gmail.com, web+postgresql@modin.io, pgsql-hackers@postgresql.org
Subject: Re: [BUGS][PATCH] BUG #14486: Inserting and selecting interval have different constraints
In-Reply-To: <CAKOSWNmbHDUnYjW__5bO3hCqdSW+QoDZKPDA6wrnde3X27RYVA@mail.gmail.com>
References: <20170104150301.10134.9126@wrigleys.postgresql.org> <CAE3TBxzkGbTt7YEfZOJfCuOv21ZKaPZ2_=Nxe65m8Xc_oQn-rg@mail.gmail.com> <CAKOSWNmn9Kqq8wC0kjG6uh9jMV6WEAXtSVPd8pVCacTDg4yJ4A@mail.gmail.com> <CAKOSWNnhovGBeQfe9N-L09WW++zaZtg7p_2fq3MpTfUkqDinAA@mail.gmail.com> <5118.1483634907@sss.pgh.pa.us> <CAKOSWNmxbjrfLqCujA1oDwQo5EEM5+ptzzQGpjjrhgCY1zq+bw@mail.gmail.com> <6048.1483636296@sss.pgh.pa.us> <CAKOSWN=69W8Lewi947zp0doTo=V85+rSspbDeiSxvTKOzYMxoA@mail.gmail.com> <15458.1483652374@sss.pgh.pa.us> <CAKOSWNmbHDUnYjW__5bO3hCqdSW+QoDZKPDA6wrnde3X27RYVA@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox