Обсуждение: BUG #4739: strange behavior of EXTRACT(quarter from INTERVAL)
The following bug has been logged online:
Bug reference: 4739
Logged by: Roman Kononov
Email address: kononov@ftml.net
PostgreSQL version: 8.3.7
Operating system: GNU/Linux x86_64
Description: strange behavior of EXTRACT(quarter from INTERVAL)
Details:
test=# select month, extract(quarter from (month::varchar || '
month')::interval) from tbl;
month | date_part
-------+-----------
-6 | -1
-5 | 0
-4 | 0
-3 | 0
-2 | 1
-1 | 1
0 | 1
1 | 1
2 | 1
3 | 2
4 | 2
5 | 2
6 | 3
(13 rows)
"Roman Kononov" <kononov@ftml.net> writes:
> Description: strange behavior of EXTRACT(quarter from INTERVAL)
Somehow I can't get excited about the definition of EXTRACT(quarter)
for zero or negative intervals. If you have an actual use-case for
this, what do you think it should do?
regards, tom lane
On 2009-03-28 11:34 Tom Lane said the following: > If you have an actual use-case for this, what do you think it should do? I don't have a use-case (other than hypothetical "how many more years and quarters did it take to complete this particular software project than that particular project"). I think that a quarter is 1/4 year and that is it. Regards, Roman
Roman Kononov <kononov@ftml.net> writes:
> On 2009-03-28 11:34 Tom Lane said the following:
>> If you have an actual use-case for this, what do you think it should do?
> I don't have a use-case (other than hypothetical "how many more years
> and quarters did it take to complete this particular software project
> than that particular project"). I think that a quarter is 1/4 year and
> that is it.
That's not really helpful for determining which way to round fractions.
I think we'll leave this alone until someone has a real use-case that
can guide the decision.
regards, tom lane