2

My production system uses Postgres 9.3 and Perl; I have a test Postgres 10.3 database that I'd like to run the same Perl scripts against to make sure that everything works.

I'm using Perl DBI and DBD::Pg to connect to the databases. I'm logging client and server versions in the scripts so that I always know what's being used.

On the production system, my log will say something like:

lib_version=90310, server_version=90310

When I run the same script against the test version, it says:

lib_version=90310, server_version=100300

How do I get DBD::Pg to use the Postgres 10 libraries? I remember having to configure DBD::Pg with some Postgres libraries when I first installed it; can I have multiple configurations for DBD::Pg? I'm using Perlbrew, so I could use that to set up a different version of Perl and then reinstall all of my modules to the different version; that would be a pain, but it's possible.

Edited: The point here is that I want to test a pure Postgres 10.3 environment without messing up the test system that needs to be in sync with the production Postgres 9.3 system. If it's not possible to have one machine use different clients, then I will have to set up a new test system.

smonff
  • 3,399
  • 3
  • 36
  • 46
Adina
  • 78
  • 6
  • If your tests are meant to figure out if you can safely upgrade your database, I would not recommend using a different Perl version, as that would falsify your test results. – simbabque May 04 '18 at 19:58
  • 1
    Are the drivers backwards compatible? If so, you could reinstall DBD::Pg using the newer drivers, using the 10 drivers for both DB – ikegami May 04 '18 at 20:17
  • 1
    Yes, the best solution is to use PostgreSQL v10 on the client side to connect to both 9.3 and v10 servers. The 9.3 client should also work, though. PostgreSQL is pretty good with version interoperability. – Laurenz Albe May 05 '18 at 04:16

0 Answers0