| From: | Quan Zongliang <quanzongliang(at)yeah(dot)net> | 
|---|---|
| To: | Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, Florents Tselai <florents(dot)tselai(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> | 
| Subject: | Re: ago(interval) → timestamptz | 
| Date: | 2025-11-04 08:53:39 | 
| Message-ID: | de0a33e0-97b9-45f1-9cbe-949db62943fe@yeah.net | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-hackers | 
On 11/4/25 1:55 PM, Laurenz Albe wrote:
> On Mon, 2025-11-03 at 22:36 +0100, Florents Tselai wrote:
>> I realize this will get some "you can easily implement this yourself” pushback,
>> But I keep seeing and writing a lot of WHERE ts > now() - interval '1 day' expressions.
> 
> You can easily implement this yourself...
> Also, there already is something similar in the shape of 'yesterday'::timestamptz.
> Moreover, a good percentage of the users would instead need ago(interval) -> timestamp.
> 
> So I'd say that the added value is marginal, and I personally find
> 
>     current_timestamp - INTERVAL '1' DAY
> 
> more readable and more SQL standard compliant than
> 
>     ago('1 day')
> 
now() - interval '1 day' is merely an example. In fact, we could use any 
time. For example
   now() - interval '10 day 5 hours 21 minutes'
This is beyond the scope of what yesterday() can support.
Therefore, I think this patch can be accepted. Make the user's operation 
more convenient.
--
Quan Zongliang
> Yours,
> Laurenz Albe
> 
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Ashutosh Bapat | 2025-11-04 08:57:12 | Extra blank line in StrategyGetBuffer | 
| Previous Message | Rahila Syed | 2025-11-04 08:47:44 | Re: Extend injection_points_attach() to accept a user-defined function |