Merge pull request #329 from CartoDB/postgresql_10_support

Postgresql 10 support
This commit is contained in:
Mario de Frutos 2018-04-09 10:43:37 +02:00 committed by GitHub
commit 17345f4fca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 58 additions and 40 deletions

View File

@ -1,43 +1,23 @@
language: c
dist: precise
group: travis_stable
sudo: required
env:
global:
- PAGER=cat
matrix:
include:
- env: PGSQL_VERSION=9.5 POSTGIS_VERSION=2.2
- env: PGSQL_VERSION=9.6 POSTGIS_VERSION=2.3
- env: PGSQL_VERSION=10 POSTGIS_VERSION=2.4
before_install:
- sudo add-apt-repository -y ppa:cartodb/postgresql-9.5
- sudo add-apt-repository -y ppa:cartodb/gis
- sudo add-apt-repository -y ppa:cartodb/gis-testing
- sudo apt-get update
# Install postgres db and build deps
- sudo /etc/init.d/postgresql stop # stop travis default instance
- sudo apt-get -y remove --purge postgresql-9.1
- sudo apt-get -y remove --purge postgresql-9.2
- sudo apt-get -y remove --purge postgresql-9.3
- sudo apt-get -y remove --purge postgresql-9.4
- sudo apt-get -y remove --purge postgresql-9.5
- sudo rm -rf /var/lib/postgresql/
- sudo rm -rf /var/log/postgresql/
- sudo rm -rf /etc/postgresql/
- sudo apt-get -y remove --purge postgis-2.2
- sudo apt-get -y autoremove
- sudo apt-get -y install postgresql-9.5=9.5.2-3cdb3
- sudo apt-get -y install postgresql-server-dev-9.5=9.5.2-3cdb3
- sudo apt-get -y install postgresql-plpython-9.5=9.5.2-3cdb3
- sudo apt-get -y install postgresql-9.5-postgis-scripts=2.2.2.0-cdb2
- sudo apt-get -y install postgresql-9.5-postgis-2.2=2.2.2.0-cdb2
# configure it to accept local connections from postgres
- echo -e "# TYPE DATABASE USER ADDRESS METHOD \nlocal all postgres trust\nlocal all all trust\nhost all all 127.0.0.1/32 trust" \
| sudo tee /etc/postgresql/9.5/main/pg_hba.conf
- sudo /etc/init.d/postgresql restart 9.5
- sudo bash $TRAVIS_BUILD_DIR/scripts/ci/install_postgres.sh
install:
- sudo make install
script:
- cd src/pg
- make test || { cat src/pg/test/regression.diffs; false; }
- make test || { cat $TRAVIS_BUILD_DIR/src/pg/test/regression.diffs; false; }

View File

@ -0,0 +1,38 @@
#!/bin/bash
# echo commands
set -x
# exit on error
set -e
dpkg -l | grep postgresql
# Add the PDGD repository
apt-key adv --keyserver keys.gnupg.net --recv-keys 7FCC7D46ACCC4CF8
add-apt-repository "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main"
apt-get update
# Remove those all PgSQL versions except the one we're testing
PGSQL_VERSIONS=(9.2 9.3 9.4 9.5 9.6 10)
/etc/init.d/postgresql stop # stop travis default instance
for V in "${PGSQL_VERSIONS[@]}"; do
if [ "$V" != "$PGSQL_VERSION" ]; then
apt-get -y remove --purge postgresql-${V} postgresql-client-${V} postgresql-contrib-${V} postgresql-${V}-postgis-2.3-scripts
else
apt-get -y remove --purge postgresql-${V}-postgis-2.3-scripts
fi
done
apt-get -y autoremove
# Install PostgreSQL
apt-get -y install postgresql-${PGSQL_VERSION} postgresql-${PGSQL_VERSION}-postgis-${POSTGIS_VERSION} postgresql-server-dev-${PGSQL_VERSION}
# Configure it to accept local connections from postgres
echo -e "# TYPE DATABASE USER ADDRESS METHOD \nlocal all postgres trust\nlocal all all trust\nhost all all 127.0.0.1/32 trust" > /etc/postgresql/${PGSQL_VERSION}/main/pg_hba.conf
# Restart PostgreSQL
/etc/init.d/postgresql restart ${PGSQL_VERSION}
dpkg -l | grep postgresql

View File

@ -12,17 +12,17 @@ SET client_min_messages TO WARNING;
-- expect most recent census tract boundary at cartodb nyc
-- timespan implictly null
SELECT cdb_observatory.OBS_GetBoundary(
SELECT st_envelope(cdb_observatory.OBS_GetBoundary(
cdb_observatory._TestPoint(),
'us.census.tiger.census_tract'
) = :'cartodb_census_tract_geometry' As OBS_GetBoundary_cartodb_census_tract;
)) = st_envelope(st_asewkb(:'cartodb_census_tract_geometry')) As OBS_GetBoundary_cartodb_census_tract;
-- expect most recent census county boundary (brooklyn) at cartodb nyc
-- timespan implictly null
SELECT cdb_observatory.OBS_GetBoundary(
SELECT st_envelope(cdb_observatory.OBS_GetBoundary(
cdb_observatory._TestPoint(),
'us.census.tiger.county'
) = :'cartodb_county_geometry' As OBS_GetBoundary_cartodb_county;
)) = st_envelope(st_asewkb(:'cartodb_county_geometry')) As OBS_GetBoundary_cartodb_county;
-- expect null geometry since boundary_id is null
-- timespan implictly null
@ -39,11 +39,11 @@ SELECT cdb_observatory.OBS_GetBoundary(
) IS NULL As OBS_GetBoundary_null_island_census_tract;
-- expect census tract boundary at cartodb nyc from 2014
SELECT cdb_observatory.OBS_GetBoundary(
SELECT st_envelope(cdb_observatory.OBS_GetBoundary(
cdb_observatory._TestPoint(),
'us.census.tiger.census_tract',
'2015'
) = :'cartodb_census_tract_geometry' As OBS_GetBoundary_year_census_tract;
)) = st_envelope(st_asewkb(:'cartodb_census_tract_geometry')) As OBS_GetBoundary_year_census_tract;
-- should return null
-- look for census tracts a year before census released them
@ -86,10 +86,10 @@ SELECT cdb_observatory.OBS_GetBoundaryId(
-- should give geometry of King's County/Brooklyn, NY
SELECT cdb_observatory.OBS_GetBoundaryById(
SELECT st_envelope(cdb_observatory.OBS_GetBoundaryById(
'36047',
'us.census.tiger.county'
) = :'cartodb_county_geometry' As OBS_GetBoundaryById_cartodb_county;
)) = st_envelope(st_asewkb(:'cartodb_county_geometry')) As OBS_GetBoundaryById_cartodb_county;
-- Should match output of GetBoundary on similar inputs
SELECT cdb_observatory.OBS_GetBoundaryById(
@ -101,11 +101,11 @@ SELECT cdb_observatory.OBS_GetBoundaryById(
) As OBS_GetBoundaryById_compared_with_obs_GetBoundary;
-- should give null since boundary_id does not match geometry reference id
SELECT cdb_observatory.OBS_GetBoundaryById(
SELECT st_envelope(cdb_observatory.OBS_GetBoundaryById(
'36047',
'us.census.tiger.county',
'2015'
) = :'cartodb_county_geometry' OBS_GetBoundaryById_boundary_id_mismatch_geom_id;
)) = st_envelope(st_asewkb(:'cartodb_county_geometry')) OBS_GetBoundaryById_boundary_id_mismatch_geom_id;
-- should give null since boundary_id does not match geometry reference id
SELECT cdb_observatory.OBS_GetBoundaryById(