On Fri, Aug 16, 2024 at 11:37:55AM -0400, Tom Lane wrote:
> Bruce Momjian <bruce@momjian.us> writes:
> > On Thu, Aug 15, 2024 at 10:45:58PM -0400, Bruce Momjian wrote:
> >> I tested master, patch version 2 and patch version 3 with some sample
> >> extract() queries, attached. I like patch version 2.
>
> I'm still pretty dissatisfied with both versions :-(
>
> > I think there are two more issues. In patch version 3, when months is
> > zero and you check days, you should also check seconds if days is zero.
>
> Eh? v3 does that:
>
> + else if (interval->day > 0 ||
> + (interval->day == 0 && interval->time >= 0))
Oh, sorry, I missed that detail.
> But I'm starting to despair of reaching a solution that's actually
> self-consistent. Maybe we should leave the DTK_QUARTER behavior
> alone, and content ourselves with adding DTK_WEEK.
Well, I liked that -4 months actually was in -2 quarter. I see your
point that if 0-2 is Q1, why is only -1 to -2 in minus Q1, but I think I
can live with that on the assumption that negative months can be handled
differently.
--
Bruce Momjian <bruce@momjian.us> https://momjian.us
EDB https://enterprisedb.com
Only you can decide what is important to you.