Re: date_trunc function in interval version

2024-05-20 Thread Przemysław Sztoch
Yasir wrote on 19.05.2024 00:03: I would also like to thank Robert for presenting the matter in detail. My function date_trunc ( interval, timestamp, ...) is similar to original function date_trunc ( text, timestamp ...) . My extension only gives more granularity. We don't

Re: date_trunc function in interval version

2024-05-18 Thread Yasir
On Sun, May 19, 2024 at 2:20 AM Przemysław Sztoch wrote: > Robert Haas wrote on 5/15/2024 9:29 PM: > > On Mon, Mar 4, 2024 at 5:03 AM Przemysław Sztoch > wrote: > > Apparently the functionality is identical to date_bin. > When I saw date_bin in the documentation, I thought it solved all my pro

Re: date_trunc function in interval version

2024-05-18 Thread Przemysław Sztoch
Robert Haas wrote on 5/15/2024 9:29 PM: On Mon, Mar 4, 2024 at 5:03 AM Przemysław Sztoch wrote: Apparently the functionality is identical to date_bin. When I saw date_bin in the documentation, I thought it solved all my problems. Unfortunately, DST problems have many corner cases. I tried to ch

Re: date_trunc function in interval version

2024-05-15 Thread Robert Haas
On Mon, Mar 4, 2024 at 5:03 AM Przemysław Sztoch wrote: > Apparently the functionality is identical to date_bin. > When I saw date_bin in the documentation, I thought it solved all my problems. > Unfortunately, DST problems have many corner cases. > I tried to change date_bin several times, but un

Re: date_trunc function in interval version

2024-03-04 Thread Przemysław Sztoch
Tomas Vondra wrote on 18.02.2024 01:29: Hi, Please don't too-post on this list. The custom is to bottom-post or reply inline, and it's much easier to follow such replies. On 12/23/23 23:45, Przemysław Sztoch wrote: date_bin has big problem with DST. In example, if you put origin in winter zone

Re: date_trunc function in interval version

2024-03-03 Thread Andrey M. Borodin
> On 18 Feb 2024, at 05:29, Tomas Vondra wrote: > > I'm not very familiar with date_bin(), but is this issue inherent or > could we maybe fix date_bin() to handle DST better? > > In particular, isn't part of the problem that date_bin() is defined only > for timestamp and not for timestamptz?

Re: date_trunc function in interval version

2024-02-17 Thread Tomas Vondra
Hi, Please don't too-post on this list. The custom is to bottom-post or reply inline, and it's much easier to follow such replies. On 12/23/23 23:45, Przemysław Sztoch wrote: > date_bin has big problem with DST. > In example, if you put origin in winter zone, then generated bin will be > incorrec

Re: date_trunc function in interval version

2023-12-23 Thread Przemysław Sztoch
date_bin has big problem with DST. In example, if you put origin in winter zone, then generated bin will be incorrect for summer input date. date_trunc is resistant for this problem. My version of date_trunc is additionally more flexible, you can select more granular interval, 12h, 8h, 6h, 15m

Re: date_trunc function in interval version

2023-12-23 Thread Pavel Stehule
so 23. 12. 2023 v 13:33 odesílatel Pavel Stehule napsal: > Hi > > pá 22. 12. 2023 v 23:25 odesílatel Przemysław Sztoch > napsal: > >> In my opinion date_trunc is very good name. >> Truncated data is timestamp type, not interval. >> First parameter has same meaning in original date_trunc and in m

Re: date_trunc function in interval version

2023-12-23 Thread Pavel Stehule
Hi pá 22. 12. 2023 v 23:25 odesílatel Przemysław Sztoch napsal: > In my opinion date_trunc is very good name. > Truncated data is timestamp type, not interval. > First parameter has same meaning in original date_trunc and in my new > version. > New version provides only more granularity. > ok,

Re: date_trunc function in interval version

2023-12-22 Thread John Naylor
On Sat, Dec 23, 2023 at 5:26 AM Przemysław Sztoch wrote: > > In my opinion date_trunc is very good name. > Truncated data is timestamp type, not interval. > First parameter has same meaning in original date_trunc and in my new version. > New version provides only more granularity. I haven't looke

Re: date_trunc function in interval version

2023-12-22 Thread Przemysław Sztoch
In my opinion date_trunc is very good name. Truncated data is timestamp type, not interval. First parameter has same meaning in original date_trunc and in my new version. New version provides only more granularity. Pavel Stehule wrote on 12/22/2023 8:43 PM: Hi pá 22. 12. 2023 v 20:26 odesílat

Re: date_trunc function in interval version

2023-12-22 Thread Pavel Stehule
Hi pá 22. 12. 2023 v 20:26 odesílatel Przemysław Sztoch napsal: > Hello. > There is date_trunc(interval, timestamptz, timezone) function. > First parameter can be '5 year', '2 month', '6 hour', '3 hour', '15 > minute', '10 second' etc. > should not be named interval_trunc instead? In this case

date_trunc function in interval version

2023-12-22 Thread Przemysław Sztoch
Hello. There is date_trunc(interval, timestamptz, timezone) function. First parameter can be '5 year', '2 month', '6 hour', '3 hour', '15 minute', '10 second' etc. -- Przemysław Sztoch | Mobile +48 509 99 00 66 diff --git a/src/backend/utils/adt/timestamp.c b/src/backend/utils/adt/timestamp.c i