> On Mar 30, 2021, at 3:12 PM, Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:
>
> On 2021-Mar-30, Mark Dilger wrote:
>
>> The problem is clear enough; -N/--nosync was added in 9.3, and
>> PostgresNode::init is passing -N to initdb unconditionally. I wonder
>> if during PostgresNode::new a call should be made to pg_config and the
>> version information grep'd out so that version specific options to
>> various functions (init, backup, etc) could hinge on the version of
>> postgres being used?
>
> Yeah, I think making it backwards-compatible would be good. Is running
> pg_config to obtain the version the best way to do it? I'm not sure --
> what other ways are there? I can't of anything. (Asking the user seems
> right out.)
Once you have a node running, you can query the version using safe_psql, but that clearly doesn't work soon enough,
sincewe need the information prior to running initdb.
One of the things I noticed while playing with this new toy (thanks, Andrew!) is that if you pass a completely insane
install_path,you don't get any errors. In fact, you get executables and libraries from whatever
PATH="/no/such/postgres:$PATH"gets you, probably the executables and libraries of your latest development branch. By
forcingget_new_node to call the pg_config of the path you pass in, you'd fix that problem. I didn't do that, mind you,
butyou could. I just executed pg_config, which means you'll still get the wrong version owing to the PATH confusion.
—
Mark Dilger
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company