Re: Catalog version access

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Vik Fearing <vik(at)postgresfriends(dot)org>, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Catalog version access
Date: 2021-04-08 09:58:49
Message-ID: CABUevEySovaEDci7c0DXOrV6c7JzWqYzfVwOiRUJxMao=9seEw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Mar 3, 2021 at 8:16 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Vik Fearing <vik(at)postgresfriends(dot)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.

Another option could be to provide a switch to the postmaster binary.
Using pg_config as originally suggested is risky because you might
pick up the wrong postmaster, but if you put it on the actual
postmaster binary you certainly know which one you're on... As this is
something that's primarily of interest to developers, it's also a bit
lower weight than having a "heavy" solution like an entire mode for
pg_ctl.

--
Magnus Hagander
Me: https://www.hagander.net/
Work: https://www.redpill-linpro.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2021-04-08 10:04:23 Order dependency in function test
Previous Message Fujii Masao 2021-04-08 09:48:13 Re: TRUNCATE on foreign table