From 80fdd005413b5cbf03a51758b34f23255ac4a628 Mon Sep 17 00:00:00 2001 From: Raul Marin Date: Wed, 2 Jan 2019 18:55:14 +0100 Subject: [PATCH 1/3] Drop functions removed in 0.11.1 --- NEWS.md | 3 +++ scripts-available/CDB_DDLTriggers.sql | 14 ++++++++++++++ scripts-enabled/900-CDB_DDLTriggers.sql | 1 + 3 files changed, 18 insertions(+) create mode 100644 scripts-available/CDB_DDLTriggers.sql create mode 120000 scripts-enabled/900-CDB_DDLTriggers.sql diff --git a/NEWS.md b/NEWS.md index 94f3557..02209fa 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,6 @@ +0.24.1 (2019-01-02) +* Drop functions removed in 0.12 (#341) + 0.24.0 (2018-09-13) * Travis: Test with PostgreSQL 9.5 and 10. * _cdb_estimated_extent: Fix bug with ST_EstimatedExtent interaction. diff --git a/scripts-available/CDB_DDLTriggers.sql b/scripts-available/CDB_DDLTriggers.sql new file mode 100644 index 0000000..6d73d31 --- /dev/null +++ b/scripts-available/CDB_DDLTriggers.sql @@ -0,0 +1,14 @@ +-- +-- Legacy file +-- Introduced again to make sure that updates do not leave dangling functions +-- + +DROP FUNCTION IF EXISTS cartodb.cdb_handle_create_table(); +DROP FUNCTION IF EXISTS cartodb.cdb_handle_drop_table(); +DROP FUNCTION IF EXISTS cartodb.cdb_handle_alter_column(); +DROP FUNCTION IF EXISTS cartodb.cdb_handle_drop_column(); +DROP FUNCTION IF EXISTS cartodb.cdb_handle_add_column(); +DROP FUNCTION IF EXISTS cartodb.cdb_disable_ddl_hooks(); +DROP FUNCTION IF EXISTS cartodb.cdb_enable_ddl_hooks(); + + diff --git a/scripts-enabled/900-CDB_DDLTriggers.sql b/scripts-enabled/900-CDB_DDLTriggers.sql new file mode 120000 index 0000000..3e15289 --- /dev/null +++ b/scripts-enabled/900-CDB_DDLTriggers.sql @@ -0,0 +1 @@ +../scripts-available/CDB_DDLTriggers.sql \ No newline at end of file From 9a3ac908a9afc886f93ba1eb668c7f41777a83ec Mon Sep 17 00:00:00 2001 From: Raul Marin Date: Wed, 2 Jan 2019 19:01:30 +0100 Subject: [PATCH 2/3] Test with PG11 --- .travis.yml | 40 ++++++++++++++++++++++++++-------------- NEWS.md | 1 + 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5d45a0a..ae454c6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,26 +1,38 @@ +dist: xenial language: c -dist: trusty sudo: required env: - - PGUSER=postgres PGDATABASE=postgres + global: + - PGUSER=postgres + - PGDATABASE=postgres + - PGOPTIONS='-c client_min_messages=NOTICE' + - PGPORT=5432 + - POSTGIS_VERSION="2.5" + + matrix: + - POSTGRESQL_VERSION="9.5" + - POSTGRESQL_VERSION="10" + - POSTGRESQL_VERSION="11" -env: - - POSTGRESQL_VERSION="9.5", POSTGIS_VERSION="2.4" - - POSTGRESQL_VERSION="10", POSTGIS_VERSION="2.4" before_install: - - export POSTGIS_PACKAGE_VERSION=$(apt list postgis -a 2>/dev/null | grep $POSTGIS_VERSION | awk '{ print $2 }') - sudo service postgresql stop; - - sudo apt-get install -y --allow-unauthenticated --no-install-recommends --no-install-suggests postgresql-$POSTGRESQL_VERSION postgresql-client-$POSTGRESQL_VERSION postgresql-server-dev-$POSTGRESQL_VERSION postgis=$POSTGIS_PACKAGE_VERSION postgresql-$POSTGRESQL_VERSION-postgis-scripts postgresql-$POSTGRESQL_VERSION-postgis-$POSTGIS_VERSION postgresql-plpython-$POSTGRESQL_VERSION - - 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/$POSTGRESQL_VERSION/main/pg_hba.conf - - export PGPORT=`grep ^port /etc/postgresql/$POSTGRESQL_VERSION/main/postgresql.conf | awk '{print $3}'` - - export PGUSER=postgres - - export PGDATABASE=postgres - - sudo service postgresql restart $POSTGRESQL_VERSION; + - sudo apt-get remove postgresql* -y + - sudo apt-get install -y --allow-unauthenticated --no-install-recommends --no-install-suggests postgresql-$POSTGRESQL_VERSION postgresql-client-$POSTGRESQL_VERSION postgresql-server-dev-$POSTGRESQL_VERSION postgresql-common + - if [[ $POSTGRESQL_VERSION == '9.5' ]]; then sudo apt-get install -y postgresql-contrib-9.5; fi; + - sudo apt-get install -y --allow-unauthenticated postgresql-$POSTGRESQL_VERSION-postgis-$POSTGIS_VERSION postgresql-$POSTGRESQL_VERSION-postgis-$POSTGIS_VERSION-scripts postgis postgresql-plpython-$POSTGRESQL_VERSION + - sudo pg_dropcluster --stop $POSTGRESQL_VERSION main + - sudo rm -rf /etc/postgresql/$POSTGRESQL_VERSION /var/lib/postgresql/$POSTGRESQL_VERSION + - sudo pg_createcluster -u postgres $POSTGRESQL_VERSION main -- -A trust + - sudo /etc/init.d/postgresql start $POSTGRESQL_VERSION || sudo journalctl -xe script: - make - sudo make install - - PGOPTIONS='-c client_min_messages=NOTICE' PGUSER=postgres make installcheck || - { cat regression.diffs; false; } + - make installcheck + +after_failure: + - pg_lsclusters + - cat regression.out + - cat regression.diffs diff --git a/NEWS.md b/NEWS.md index 02209fa..17ec9c2 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,6 @@ 0.24.1 (2019-01-02) * Drop functions removed in 0.12 (#341) +* Travis: Test with PostgreSQL 9.5, 10 and 11. 0.24.0 (2018-09-13) * Travis: Test with PostgreSQL 9.5 and 10. From 6c57751579bd9185d08015aac3de299b61571404 Mon Sep 17 00:00:00 2001 From: Raul Marin Date: Wed, 2 Jan 2019 19:33:28 +0100 Subject: [PATCH 3/3] CDB_TransformToWebmercator: Yet another hack over a function that shouldn't exist --- scripts-available/CDB_TransformToWebmercator.sql | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts-available/CDB_TransformToWebmercator.sql b/scripts-available/CDB_TransformToWebmercator.sql index 42ccc49..5ab7efd 100644 --- a/scripts-available/CDB_TransformToWebmercator.sql +++ b/scripts-available/CDB_TransformToWebmercator.sql @@ -31,13 +31,17 @@ BEGIN -- Then we transform to WGS84 latlon, which is -- where we have known coordinates for the clipping - -- + -- latlon_input := ST_Transform(geom, 4326); -- Don't bother clipping if the geometry boundary doesn't -- go outside the valid extent. IF latlon_input @ valid_extent THEN - RETURN ST_Transform(latlon_input, 3857); + BEGIN + RETURN ST_Transform(latlon_input, 3857); + EXCEPTION WHEN OTHERS THEN + RETURN NULL; + END; END IF; -- Since we're going to use ST_Intersection on input @@ -65,7 +69,7 @@ BEGIN -- We transform to web mercator to_webmercator := ST_Transform(clipped_input, 3857); - -- Finally we convert EMPTY to NULL + -- Finally we convert EMPTY to NULL -- See https://github.com/Vizzuality/cartodb/issues/706 -- And retain "multi" status ret := CASE WHEN ST_IsEmpty(to_webmercator) THEN NULL::geometry