| From: | Andreas Karlsson <andreas(at)proxel(dot)se> |
|---|---|
| To: | Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, Florents Tselai <florents(dot)tselai(at)gmail(dot)com> |
| Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: ago(interval) → timestamptz |
| Date: | 2025-11-08 08:09:55 |
| Message-ID: | 64af9562-9e4f-4363-a7b0-4b6249a8de43@proxel.se |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On 11/6/25 3:54 PM, Laurenz Albe wrote:
> On Thu, 2025-11-06 at 12:15 +0100, Florents Tselai wrote:
>>> I don't get what users would need ago(interval) -> timestamp. That function would
>>> not make any sense since there is no equivalent to now() which returns timestamp,
>>> simply because a timestamp does not refer to any specific point in time and can
>>> only be interpreted with some additional piece of information like a time zone.
>>
>> I agree that only a timestamptz variant makes sense.
>
> Lots of people model absolute time using "timestamp without time zone" with the
> silent assumption that all such timestamps are UTC timestamps. That would be
> the additional piece of information.
>
> But I admit that that makes date arithmetic less useful.
>
> There is an equivalent for "now()": localtimestamp
Oh, did not know of that function but using timestamp like this is
dangerous and a bad idea. Let's not make life easier for people who
misuse data types. The localtimestamp function should not have been
introduced in the first place.
Andreas
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Andreas Karlsson | 2025-11-08 08:57:13 | Re: display hot standby state in psql prompt |
| Previous Message | cca5507 | 2025-11-08 07:59:02 | Use bsearch() instead of a manual binary search in syscache.c |