From 4d60a211de3470d245f8a72356cadf59e657ebe8 Mon Sep 17 00:00:00 2001 From: Andy Eschbacher Date: Wed, 11 May 2016 13:37:40 -0400 Subject: [PATCH 1/2] fixes timespan mis-naming issue --- src/pg/sql/42_observatory_exploration.sql | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/pg/sql/42_observatory_exploration.sql b/src/pg/sql/42_observatory_exploration.sql index 338298e..e0ab8ef 100644 --- a/src/pg/sql/42_observatory_exploration.sql +++ b/src/pg/sql/42_observatory_exploration.sql @@ -89,14 +89,15 @@ DECLARE timespan_query TEXT DEFAULT ''; BEGIN - IF time_span != null THEN - timespan_query = format('AND timespan = %L', time_span); + IF timespan != NULL + THEN + timespan_query = format('AND timespan = %L', timespan); END IF; RETURN QUERY EXECUTE $string$ - select + SELECT column_id, obs_column.description, timespan, @@ -109,11 +110,10 @@ BEGIN observatory.OBS_column_table.column_id = observatory.obs_column.id AND observatory.OBS_column_table.table_id = observatory.obs_table.id AND - observatory.OBS_column.type='Geometry' + observatory.OBS_column.type = 'Geometry' AND $1 && bounds::box2d $string$ || timespan_query - USING geom - RETURN; + USING geom; END $$ LANGUAGE plpgsql; From ebb2af249be9576b553bf4bb8ec1b49d29e519d9 Mon Sep 17 00:00:00 2001 From: Andy Eschbacher Date: Thu, 12 May 2016 08:31:20 -0400 Subject: [PATCH 2/2] adding back missing return; --- src/pg/sql/42_observatory_exploration.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pg/sql/42_observatory_exploration.sql b/src/pg/sql/42_observatory_exploration.sql index e0ab8ef..9dfc866 100644 --- a/src/pg/sql/42_observatory_exploration.sql +++ b/src/pg/sql/42_observatory_exploration.sql @@ -115,5 +115,6 @@ BEGIN $1 && bounds::box2d $string$ || timespan_query USING geom; + RETURN; END $$ LANGUAGE plpgsql;