Could just use a CASE for that particular case:
CASE WHEN now()-latest_vacuum < '1 day'
THEN '0 days '
ELSE '' END
|| DATE_TRUNC('second', now()-latest_vacuum) AS vacuumed_ago
Cheers,
Greg
Ron Johnson writes:
> PG 9.6.24, if relevant. (Hopefully we're migrating next month.)
> Displaying how long ago a date was is easy, but interval casts "helpfully"
> suppress "X days ago" if the interval is less than one day ago.
> How do I make it display "days ago", even when days ago is zero?
PG 9.6.24, if relevant. (Hopefully we're migrating next month.)
Displaying how long ago a date was is easy, but interval casts "helpfully"
suppress "X days ago" if the interval is less than one day ago.
How do I make it display "days ago", even when days ago is zero?
Explicitly casting "day to s