Re: Catalog version access

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Vik Fearing <vik(at)postgresfriends(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Catalog version access
Date: 2021-02-22 01:53:52
Message-ID: 3524361.1613958832@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andres Freund <andres(at)anarazel(dot)de> writes:
> On 2021-02-21 19:54:01 -0500, Tom Lane wrote:
>> FWIW, I think asking pg_config about this is a guaranteed way of having
>> version-skew-like bugs.

> Could you elaborate a bit?

How do you know that the pg_config you found has anything to do with the
server you're connected to?

>> If we're going to bother with providing a way
>> to get this info, we should make it possible to ask the running server.

> In Vik's case there is no running server to ask, IIUC.

Hm. If you're about to initdb or start the server then there's more
reason to think you can find a matching pg_config. Still, pg_config
is not going to tell you what is actually in the data directory, so
it's not clear to me how it helps with "do I need to initdb?".

> He has an
> existing cluster running an "old" set of binaries, and a set of
> binaries. He wants to know if he needs to pg_upgrade, or can start from
> a basebackup. The old version he can get from pg_controldata, or the
> catalog. But except for initdb'ing a throw-away cluster, there's no way
> to get that for the new cluster that doesn't involve grepping headers...

For production cases it'd be sufficient to compare pg_config --version
output. I suppose if you want to automate this for development versions
you'd wish for something more fine-grained ... but I think you can
already use configure's --with-extra-version to stick catversion or
whatever into the --version string.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message tsunakawa.takay@fujitsu.com 2021-02-22 01:59:28 RE: Parallel INSERT (INTO ... SELECT ...)
Previous Message Andres Freund 2021-02-22 01:34:36 Re: Catalog version access