Re: multi-install PostgresNode fails with older postgres versions

Alvaro Herrera <alvherre@alvh.no-ip.org>

From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Andrew Dunstan <andrew@dunslane.net>
Cc: Jehan-Guillaume de Rorthais <jgdr@dalibo.com>, Mark Dilger <mark.dilger@enterprisedb.com>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2021-04-07T20:19:35Z
Lists: pgsql-hackers
On 2021-Apr-07, Andrew Dunstan wrote:

> b) as it stands pgaTester.pm can't be used for multiple versions in a
> single program, which is a design goal here - it sets the single class
> to invoke in its BEGIN block. At the very least we would need to replace
> that with code which would require the relevant class as needed.

I'm not suggesting that we adopt pgaTester.pm!  I think a real patch for
this approach involves moving that stuff into PostgresNode::new itself,
as I said upthread: if install_path is given, call pg_config --version
and then parse the version number into a class name $versionclass, then
"bless $versionclass, $self".  So the object returned by
PostgresNode::new already has the correct class.  We don't need to
require anything, since all classes are in the same PostgresNode.pm
file.

-- 
Álvaro Herrera       Valdivia, Chile
"This is what I like so much about PostgreSQL.  Most of the surprises
are of the "oh wow!  That's cool" Not the "oh shit!" kind.  :)"
Scott Marlowe, http://archives.postgresql.org/pgsql-admin/2008-10/msg00152.php



Commits

  1. Teach PostgresVersion all the ways to mark non-release code

  2. Make PostgresNode version aware

  3. Avoid unfortunate IPC::Run path caching in PostgresNode

  4. Change pg_ctl to detect server-ready by watching status in postmaster.pid.