Installing multiple versions of PostgreSQL under Xenial

Hi, under Trusty I was able to specify multiple PostgreSQL versions, but under Xenial only the last in the list of versions is installed. So in the example below, only PostgreSQL version 10 is installed.

services:
  - postgresql
addons:
  postgresql: "9.5"
  postgresql: "9.6"
  postgresql: "10"

How should I install multiple versions of PostgreSQL under Xenial?

Thanks for your help,

Tony.

Please review how YAML works. In particular, with the hash/map/dictionary, only the last one is effective.

If you wish to test with different versions of PostgreSQL, you need to define jobs with different versions; e.g.,

matrix:
  include:
    - addons:
      postgresql: "9.5"
    - addons:
      postgresql: "9.6"
    - addons:
      postgresql: "10"

Great, thanks!

Is there documentation somewhere of exactly which versions of Postgres are available via a simple addon and which require additional apt: config? I tired addons: {postgresql: "10"} and got:

    [0K$ travis_setup_postgresql 10
    e[33;1mStarting PostgreSQL v10e[0K
    * Stopping PostgreSQL 9.2 database server       e[80G 
    e[74G[ OK ]
    * Stopping PostgreSQL 9.3 database server       e[80G 
    e[74G[ OK ]
    * Stopping PostgreSQL 9.4 database server       e[80G 
    e[74G[ OK ]
    * Stopping PostgreSQL 9.5 database server       e[80G 
    e[74G[ OK ]
    * Stopping PostgreSQL 9.6 database server       e[80G 
    e[74G[ OK ]
    PostgreSQL 10 is not installed!
    sudo service postgresql start 10

But then was unable to connect to it.

Were you using Trusty or Xenial?

The former does not have 10 pre-installed, but the latter should succeed (never mind the build’s failure; it’s not meant to).

1 Like