BUG #14850: Implement optinal additinal parameter for 'justify' date/time function

From: kes-kes(at)yandex(dot)ru
To: pgsql-bugs(at)postgresql(dot)org
Cc: kes-kes(at)yandex(dot)ru
Subject: BUG #14850: Implement optinal additinal parameter for 'justify' date/time function
Date: 2017-10-11 10:35:12
Message-ID: 20171011103512.1452.9244@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-general pgsql-hackers

The following bug has been logged on the website:

Bug reference: 14850
Logged by: Eugen Konkov
Email address: kes-kes(at)yandex(dot)ru
PostgreSQL version: 10.0
Operating system: Linux mint 18: Linux work 4.4.0-57-generic #78-Ubu
Description:

Hi. I try to do next math:

select extract( month from justify_days( timestamp '2016-01-31' +interval '1
month' -timestamp '2016-01-31') );
date_part
-----------
0
(1 row)

I expect `1` but get `0`. But here everything is right:

>Adjust interval so 30-day time periods are represented as months

https://www.postgresql.org/docs/9.6/static/functions-datetime.html

But with ability to setup justify date the math will be more sharp.

Please implement next feature:

select extract( month from justify_days( timestamp '2016-01-31' +interval '1
month' -timestamp '2016-01-31'), timestamp '2016-01-31' );
date_part
-----------
1
(1 row)

This is useful when I try to calculate how much month are left between
service start and end dates.

Thank you.

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message johannes graƫn 2017-10-11 11:06:46 performance drop after upgrade (9.6 > 10)
Previous Message Yugo Nagata 2017-10-11 09:36:29 [PATCH] Lockable views

Browse pgsql-bugs by date

  From Date Subject
Next Message Pavel Stehule 2017-10-11 14:11:23 Re: BUG #14850: Implement optinal additinal parameter for 'justify' date/time function
Previous Message Lukas Eder 2017-10-11 08:49:19 Combination of ordered-set aggregate function terminates JDBC connection on PostgreSQL 9.6.5

Browse pgsql-general by date

  From Date Subject
Next Message Seamus Abshere 2017-10-11 13:43:26 Determine size of table before it's committed?
Previous Message Simon Riggs 2017-10-11 08:27:17 Re: startup process stuck in recovery