Can only answer in general terms since I don't use SUSE.
There are a few hints in the DBD::Pg README file
| By default Makefile.PL uses App::Info to find the location of the |
PostgreSQL library and include directories. However, if you want to
control it yourself, define the environment variables POSTGRES_INCLUDE
and POSTGRES_LIB, or define just POSTGRES_HOME. Note that if you have
compiled PostgreSQL with SSL support, you must define the POSTGRES_LIB
environment variable and add "-lssl" and "-lcrypto" to it, like this:
export POSTGRES_LIB="/usr/local/pgsql/lib -lssl -lcrypto"
So you can define those environment variables right in the shell before you run CPAN. The other variables mentioned in your post should be set also, but they are only needed for the automated tests.
| The tests rely on being able to connect to a valid Postgres database. |
The easiest way to ensure this is to set the following environment variables:
If you are running on a non-standard port, you must set PGPORT or
add the port to the DBI_DSN variable like this:
As far as having two versions of postgres on one machine, if that wasn't intended, you can edit the postgres makefile to specify where you want the install to occur. Just add the --prefix option when running configure. List of options in the docs
If you are running two versions of postgres on the same machine, you can run them both at the same time by setting one to use a different port, or you can only run one at a time. You will have to choose which method to use.
Although you can set the environment variables directly from the command line and get CPAN to find the desired version of postgres this time, remember that as soon as that shell session ends, the environment variables will be lost. The next time you log in you will have to set them again in order to use the right DB by default.
You can avoid that by setting up your shell to define those variables at startup. Example, if you use zsh, you can edit ~/.zshrc to include something like
Whatever the locations are for the version of postgres you want to use.
If you or a program does not specify the full path, this path variable is used to look for a match. By putting the path to the new version of postgres first, that's the one that will be found when you simply type something like 'psql'.