Re: truncating timestamps on arbitrary intervals

From: John Naylor <john(dot)naylor(at)enterprisedb(dot)com>
To: Justin Pryzby <pryzby(at)telsasoft(dot)com>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: truncating timestamps on arbitrary intervals
Date: 2021-03-30 16:50:28
Message-ID: CAFBsxsEEm1nuhZmfVQxvu_i3nDDEuvNJ_WMrDo9whFD_jusp-A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Mar 27, 2021 at 1:06 PM Justin Pryzby <pryzby(at)telsasoft(dot)com> wrote:
>
> The current docs seem to be missing a "synopsis", like
>
> +<synopsis>
> +date_trunc(<replaceable>stride</replaceable>,
<replaceable>timestamp</replaceable>, <replaceable>origin</replaceable>)
> +</synopsis>

The attached
- adds a synopsis
- adds a bit more description to the parameters similar to those in
date_trunc
- documents that negative intervals are treated the same as positive ones

Note on the last point: This just falls out of the math, so was not
deliberate, but it seems fine to me. We could ban negative intervals, but
that would possibly just inconvenience some people unnecessarily. We could
also treat negative strides differently somehow, but I don't immediately
see a useful and/or intuitive change in behavior to come of that.

--
John Naylor
EDB: http://www.enterprisedb.com

Attachment Content-Type Size
synopsis-and-add-to-description.patch application/octet-stream 1.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2021-03-30 16:55:06 Re: Autovacuum worker doesn't immediately exit on postmaster death
Previous Message Zhihong Yu 2021-03-30 16:37:43 Re: Hybrid Hash/Nested Loop joins and caching results from subplans