News for hackers. Stuff that matters.
Re:PostgreSQL's Missing DateDiff Function by castorp on Wednesday December 22, 2021 @02:03AM (#29646321)
I never understood the need for a datediff function. In Postgres (or Oracle) you just subtract two timestamps and use the resulting interval. It's a different approach to the same problem.
Re:PostgreSQL's Missing DateDiff Function by michael-ax on Wednesday December 22, 2021 @06:41AM (#29648021)
one is counting distance, the other one buckets. alias the fn name to datebucketdelta to make the different problems memorable individually. :)
Re:PostgreSQL's Missing DateDiff Function by castorp on Wednesday December 22, 2021 @08:12AM (#29648829)
Well for "counting buckets" you can use `date_bin()` since Postgres 14 which groups the difference between timestamps into defined intervals.