Re: Greatest of a list of columns? - Mailing list pgsql-general

From Pavel Stehule
Subject Re: Greatest of a list of columns?
Date
Msg-id CAFj8pRCQtu7XCUB-37B-Jj57zkKYtN=osBCRdtFzXTx7cdBAyA@mail.gmail.com
Whole thread Raw
In response to Greatest of a list of columns?  (Ron <ronljohnsonjr@gmail.com>)
Responses Re: Greatest of a list of columns?
List pgsql-general


čt 1. 7. 2021 v 15:26 odesílatel Ron <ronljohnsonjr@gmail.com> napsal:
Postgresql 12.5


What's the canonical Postgresql method for doing, for example, this?
SELECT relname, MAXOF(last_vacuum, last_autovacuum)
FROM pg_stat_user_tables;

Seeing both last_vacuum and last_autovacuum is useful, of course, but
sometimes I only want to see the "really" last time it was vacuumed.

I can hard code a case statement, but a generic multi-column solution is
preferred.

 postgres=# select greatest(current_date, current_date + 1);
┌────────────┐
│  greatest  │
╞════════════╡
│ 2021-07-02 │
└────────────┘
(1 row)

Pavel



Thanks

--
Angular momentum makes the world go 'round.


pgsql-general by date:

Previous
From: Ron
Date:
Subject: Greatest of a list of columns?
Next
From: Pavel Stehule
Date:
Subject: Re: Greatest of a list of columns?