I have tests that work locally when connecting to a Postgres server version 10.5 but which fail on Travis, apparently due to a use of IF NOT EXISTS syntax that was apparently added in Postgres 9.1.
My .travis.yml is:
language: node_js
node_js:
   - "8"
   - "9"
   - "10"
   - "stable"
# Use faster Docker architecture on Travis.
sudo: false
services:
  - postgresql
script:        ./scripts/validate.sh
after_success: npm run coveralls
I tried several variants from "Using a different postgresql version":
The Travis CI build environments use version 9.2 by default on Trusty images, but other versions from the official PostgreSQL APT repository are also available. To use a version other than the default, specify only the major.minor version in your
.travis.yml:
but then builds started failing on which postgres so it looks like there's no longer a postgres on PATH.
I tried manually appending to the path in before_script to add /usr/lib/postgresql/10/bin/ to PATH per postgresql-10 but that didn't help.
I don't need to start a database service on a well-known port -- my test and local development scripts run initdb and start up a local database that the tests connect to via a named pipe.
How can I get a modern version of a postgres server binary and related tools like initdb available to my test scripts?
