public inbox for [email protected]  
help / color / mirror / Atom feed
From: Greg Sabino Mullane <[email protected]>
To: Ron Johnson <[email protected]>
Cc: pgsql-general <[email protected]>
Subject: Re: Forcing INTERVAL days display, even if the interval is less than one day
Date: Tue, 7 May 2024 15:47:14 -0400
Message-ID: <CAKAnmm+C-8Hr8=3srR9tNbDrMnQG_Qwc+cgvFT9NJHuhWcyo8Q@mail.gmail.com> (raw)
In-Reply-To: <CANzqJaCt-mX2-AzF1j8mRr1xj95_y3JJk=0JHuvn24XDwW3jhg@mail.gmail.com>
References: <CANzqJaCt-mX2-AzF1j8mRr1xj95_y3JJk=0JHuvn24XDwW3jhg@mail.gmail.com>

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


reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: Forcing INTERVAL days display, even if the interval is less than one day
  In-Reply-To: <CAKAnmm+C-8Hr8=3srR9tNbDrMnQG_Qwc+cgvFT9NJHuhWcyo8Q@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox