Vik Fearing <v...@postgresfriends.org> writes: > On 3/3/21 6:35 PM, Peter Eisentraut wrote: >> If what you want to know is whether a given binary can run against a >> given data directory then CATALOG_VERSION_NO isn't the only thing you >> need to check. The full truth of this is in ReadControlFile(). The >> best way to get that answer is to start a server and see if it >> complains. You can even grep the log for "It looks like you need to >> initdb.".
> In that case, what would everyone think about a `pg_ctl check` option? The trouble with Peter's recipe is that it doesn't work if there is already a server instance running there (or at least I think we'll bitch about the existing postmaster first, maybe I'm wrong). Now, that's not such a big problem for the use-case you were describing. But I bet if we expose this method as an apparently-general-purpose pg_ctl option, there'll be complaints. regards, tom lane