From af69b44f25872da5852849a0a54769a5ad58de7d Mon Sep 17 00:00:00 2001 From: John Krauss Date: Tue, 26 Jul 2016 13:05:40 +0000 Subject: [PATCH 1/2] Always default to NULL, fixes #173 --- src/pg/sql/44_observatory_geometries.sql | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/pg/sql/44_observatory_geometries.sql b/src/pg/sql/44_observatory_geometries.sql index 0ca42d4..dd962f9 100644 --- a/src/pg/sql/44_observatory_geometries.sql +++ b/src/pg/sql/44_observatory_geometries.sql @@ -244,7 +244,7 @@ CREATE OR REPLACE FUNCTION cdb_observatory._OBS_GetBoundariesByGeometry( geom geometry(Geometry, 4326), boundary_id text, time_span text DEFAULT NULL, - overlap_type text DEFAULT 'intersects') + overlap_type text DEFAULT NULL) RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ DECLARE @@ -253,7 +253,7 @@ DECLARE geoid_colname text; target_table text; BEGIN - + overlap_type := COALESCE(overlap_type, 'intersects'); -- check inputs IF lower(overlap_type) NOT IN ('contains', 'intersects', 'within') THEN @@ -318,7 +318,7 @@ CREATE OR REPLACE FUNCTION cdb_observatory.OBS_GetBoundariesByGeometry( geom geometry(Geometry, 4326), boundary_id text, time_span text DEFAULT NULL, - overlap_type text DEFAULT 'intersects') + overlap_type text DEFAULT NULL) RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ BEGIN @@ -364,7 +364,7 @@ CREATE OR REPLACE FUNCTION cdb_observatory.OBS_GetBoundariesByPointAndRadius( radius numeric, -- radius in meters boundary_id text, time_span text DEFAULT NULL, - overlap_type text DEFAULT 'intersects') + overlap_type text DEFAULT NULL) RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ DECLARE @@ -382,7 +382,8 @@ BEGIN FROM cdb_observatory._OBS_GetBoundariesByGeometry( circle_boundary, boundary_id, - time_span); + time_span, + overlap_type); RETURN; END; $$ LANGUAGE plpgsql; @@ -394,7 +395,7 @@ CREATE OR REPLACE FUNCTION cdb_observatory._OBS_GetPointsByGeometry( geom geometry(Geometry, 4326), boundary_id text, time_span text DEFAULT NULL, - overlap_type text DEFAULT 'intersects') + overlap_type text DEFAULT NULL) RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ DECLARE @@ -403,6 +404,7 @@ DECLARE geoid_colname text; target_table text; BEGIN + overlap_type := COALESCE(overlap_type, 'intersects'); IF lower(overlap_type) NOT IN ('contains', 'within', 'intersects') THEN @@ -464,7 +466,7 @@ CREATE OR REPLACE FUNCTION cdb_observatory.OBS_GetPointsByGeometry( geom geometry(Geometry, 4326), boundary_id text, time_span text DEFAULT NULL, - overlap_type text DEFAULT 'intersects') + overlap_type text DEFAULT NULL) RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ BEGIN @@ -509,7 +511,7 @@ CREATE OR REPLACE FUNCTION cdb_observatory.OBS_GetPointsByPointAndRadius( radius numeric, -- radius in meters boundary_id text, time_span text DEFAULT NULL, - overlap_type text DEFAULT 'intersects') + overlap_type text DEFAULT NULL) RETURNS TABLE(the_geom geometry, geom_refs text) AS $$ DECLARE From e9857e89fb912f263fdeed051190f838850262d2 Mon Sep 17 00:00:00 2001 From: John Krauss Date: Tue, 26 Jul 2016 13:08:28 +0000 Subject: [PATCH 2/2] release-v-1.0.4 increment and news --- NEWS.md | 8 ++++++++ src/pg/observatory.control | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 15d316e..bfbb82e 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,11 @@ +1.0.4 (2016-07-26) + +__Bugfixes__ + +* Always default arguments to `NULL`, which prevents duplication & overwrite by + dataservices-api + ([#173](https://github.com/CartoDB/observatory-extension/issues/173)) + 1.0.3 (2016-07-25) __Bugfixes__ diff --git a/src/pg/observatory.control b/src/pg/observatory.control index a97eced..20d9a45 100644 --- a/src/pg/observatory.control +++ b/src/pg/observatory.control @@ -1,5 +1,5 @@ comment = 'CartoDB Observatory backend extension' -default_version = '1.0.3' +default_version = '1.0.4' requires = 'postgis, postgres_fdw' superuser = true schema = cdb_observatory