Re: date_trunc() in a specific time zone - Mailing list pgsql-hackers

From Paul A Jungwirth
Subject Re: date_trunc() in a specific time zone
Date
Msg-id CA+renyVsqctZDsAPB15NPXPO5NEC2ELmTz=pEWoNZZDSjmeFeg@mail.gmail.com
Whole thread Raw
In response to Re: date_trunc() in a specific time zone  (Vik Fearing <vik.fearing@2ndquadrant.com>)
Responses Re: date_trunc() in a specific time zone  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Mon, Oct 29, 2018 at 9:40 AM Vik Fearing <vik.fearing@2ndquadrant.com> wrote:
> I don't necessarily want to
> display any dates, I could be grouping and aggregating.

I can attest that this patch would be really nice functionality to
have. Grouping is an often-overlooked case where timezones matter.
When grouping by day (e.g.), the timezone determines where you "slice
up" the timeline. I've needed this often enough that I have a personal
extension for it (https://github.com/pjungwir/pjpg) but that repo is a
bit sloppy, and I can't use it on managed services like RDS.

It would be nice to support both timestamptz and timestamp, with the
output matching whatever type you give as input. I know which to use
is controversial, but plain timestamp is the default in Ruby on Rails,
so people encounter it a lot.

Yours,
Paul


pgsql-hackers by date:

Previous
From: Andrew Gierth
Date:
Subject: Re: FETCH FIRST clause WITH TIES option
Next
From: Tom Lane
Date:
Subject: Re: date_trunc() in a specific time zone