Merge pull request #174 from CartoDB/all-null-defaults

Always default to NULL, fixes #173
This commit is contained in:
john krauss
2016-07-26 09:03:53 -04:00
committed by GitHub
+10 -8
View File
@@ -244,7 +244,7 @@ CREATE OR REPLACE FUNCTION cdb_observatory._OBS_GetBoundariesByGeometry(
geom geometry(Geometry, 4326), geom geometry(Geometry, 4326),
boundary_id text, boundary_id text,
time_span text DEFAULT NULL, time_span text DEFAULT NULL,
overlap_type text DEFAULT 'intersects') overlap_type text DEFAULT NULL)
RETURNS TABLE(the_geom geometry, geom_refs text) RETURNS TABLE(the_geom geometry, geom_refs text)
AS $$ AS $$
DECLARE DECLARE
@@ -253,7 +253,7 @@ DECLARE
geoid_colname text; geoid_colname text;
target_table text; target_table text;
BEGIN BEGIN
overlap_type := COALESCE(overlap_type, 'intersects');
-- check inputs -- check inputs
IF lower(overlap_type) NOT IN ('contains', 'intersects', 'within') IF lower(overlap_type) NOT IN ('contains', 'intersects', 'within')
THEN THEN
@@ -318,7 +318,7 @@ CREATE OR REPLACE FUNCTION cdb_observatory.OBS_GetBoundariesByGeometry(
geom geometry(Geometry, 4326), geom geometry(Geometry, 4326),
boundary_id text, boundary_id text,
time_span text DEFAULT NULL, time_span text DEFAULT NULL,
overlap_type text DEFAULT 'intersects') overlap_type text DEFAULT NULL)
RETURNS TABLE(the_geom geometry, geom_refs text) RETURNS TABLE(the_geom geometry, geom_refs text)
AS $$ AS $$
BEGIN BEGIN
@@ -364,7 +364,7 @@ CREATE OR REPLACE FUNCTION cdb_observatory.OBS_GetBoundariesByPointAndRadius(
radius numeric, -- radius in meters radius numeric, -- radius in meters
boundary_id text, boundary_id text,
time_span text DEFAULT NULL, time_span text DEFAULT NULL,
overlap_type text DEFAULT 'intersects') overlap_type text DEFAULT NULL)
RETURNS TABLE(the_geom geometry, geom_refs text) RETURNS TABLE(the_geom geometry, geom_refs text)
AS $$ AS $$
DECLARE DECLARE
@@ -382,7 +382,8 @@ BEGIN
FROM cdb_observatory._OBS_GetBoundariesByGeometry( FROM cdb_observatory._OBS_GetBoundariesByGeometry(
circle_boundary, circle_boundary,
boundary_id, boundary_id,
time_span); time_span,
overlap_type);
RETURN; RETURN;
END; END;
$$ LANGUAGE plpgsql; $$ LANGUAGE plpgsql;
@@ -394,7 +395,7 @@ CREATE OR REPLACE FUNCTION cdb_observatory._OBS_GetPointsByGeometry(
geom geometry(Geometry, 4326), geom geometry(Geometry, 4326),
boundary_id text, boundary_id text,
time_span text DEFAULT NULL, time_span text DEFAULT NULL,
overlap_type text DEFAULT 'intersects') overlap_type text DEFAULT NULL)
RETURNS TABLE(the_geom geometry, geom_refs text) RETURNS TABLE(the_geom geometry, geom_refs text)
AS $$ AS $$
DECLARE DECLARE
@@ -403,6 +404,7 @@ DECLARE
geoid_colname text; geoid_colname text;
target_table text; target_table text;
BEGIN BEGIN
overlap_type := COALESCE(overlap_type, 'intersects');
IF lower(overlap_type) NOT IN ('contains', 'within', 'intersects') IF lower(overlap_type) NOT IN ('contains', 'within', 'intersects')
THEN THEN
@@ -464,7 +466,7 @@ CREATE OR REPLACE FUNCTION cdb_observatory.OBS_GetPointsByGeometry(
geom geometry(Geometry, 4326), geom geometry(Geometry, 4326),
boundary_id text, boundary_id text,
time_span text DEFAULT NULL, time_span text DEFAULT NULL,
overlap_type text DEFAULT 'intersects') overlap_type text DEFAULT NULL)
RETURNS TABLE(the_geom geometry, geom_refs text) RETURNS TABLE(the_geom geometry, geom_refs text)
AS $$ AS $$
BEGIN BEGIN
@@ -509,7 +511,7 @@ CREATE OR REPLACE FUNCTION cdb_observatory.OBS_GetPointsByPointAndRadius(
radius numeric, -- radius in meters radius numeric, -- radius in meters
boundary_id text, boundary_id text,
time_span text DEFAULT NULL, time_span text DEFAULT NULL,
overlap_type text DEFAULT 'intersects') overlap_type text DEFAULT NULL)
RETURNS TABLE(the_geom geometry, geom_refs text) RETURNS TABLE(the_geom geometry, geom_refs text)
AS $$ AS $$
DECLARE DECLARE