Andres Freund <and...@anarazel.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