Merge branch 'develop' into update-total-pop-column-ids

This commit is contained in:
Andy Eschbacher
2016-05-16 16:50:15 -04:00
9 changed files with 642 additions and 824 deletions

View File

@@ -358,11 +358,11 @@ BEGIN
' INTO denominator_id
USING measure_id;
measure_ids := ARRAY[measure_id, denominator_id];
ELSIF normalize IS NULL OR normalize ILIKE 'none' THEN
ELSIF normalize ILIKE 'none' THEN
-- TODO we need a switch on obs_get to disable area normalization
RAISE EXCEPTION 'No normalization not yet supported.';
ELSE
RAISE EXCEPTION 'Only valid inputs for "normalize" are "area" (default), "denominator", or "none".';
RAISE EXCEPTION 'Only valid inputs for "normalize" are "area" (default) and "denominator".';
END IF;
EXECUTE '

View File

@@ -15,7 +15,7 @@ BEGIN
THEN
RETURN QUERY
EXECUTE
'SELECT tablename, timespan
'SELECT tablename::text, timespan::text
FROM observatory.obs_table t
JOIN observatory.obs_column_table ct
ON ct.table_id = t.id
@@ -24,10 +24,11 @@ BEGIN
WHERE c.type ILIKE ''geometry''
AND c.id = $1'
USING search_term;
RETURN;
ELSE
RETURN QUERY
EXECUTE
'SELECT tablename, timespan
'SELECT tablename::text, timespan::text
FROM observatory.obs_table t
JOIN observatory.obs_column_table ct
ON ct.table_id = t.id
@@ -37,6 +38,7 @@ BEGIN
AND c.id = $1
AND t.timespan = $2'
USING search_term, time_span;
RETURN;
END IF;
END;
@@ -63,9 +65,9 @@ BEGIN
RETURN QUERY
EXECUTE format($string$
SELECT id, description,
name,
aggregate,
SELECT id::text, description::text,
name::text,
aggregate::text,
NULL::TEXT source -- TODO use tags
FROM observatory.OBS_column
where name ilike '%%' || %L || '%%'
@@ -98,10 +100,10 @@ BEGIN
EXECUTE
$string$
SELECT
column_id,
obs_column.description,
timespan,
tablename
column_id::text As column_id,
obs_column.description::text As description,
timespan::text As timespan,
tablename::text As tablename
FROM
observatory.OBS_table,
observatory.OBS_column_table,

View File

@@ -119,7 +119,7 @@ BEGIN
-- If not point, raise error
IF ST_GeometryType(geom) != 'ST_Point'
THEN
RAISE EXCEPTION 'Error: Invalid geometry type (%), expecting ''ST_Point''', ST_GeometryType(geom);
RAISE EXCEPTION 'Invalid geometry type (%), expecting ''ST_Point''', ST_GeometryType(geom);
END IF;
-- choose appropriate table based on time_span
@@ -143,7 +143,7 @@ BEGIN
-- if no tables are found, raise notice and return null
IF target_table IS NULL
THEN
RAISE NOTICE 'No boundaries found for ''%''', boundary_id;
RAISE NOTICE 'Warning: No boundaries found for ''%''', boundary_id;
RETURN NULL::text;
END IF;
@@ -537,9 +537,9 @@ BEGIN
RETURN QUERY
EXECUTE
format($string$
SELECT geoid_ct.colname As geoid_colname,
tablename,
geom_ct.colname As geom_colname
SELECT geoid_ct.colname::text As geoid_colname,
tablename::text,
geom_ct.colname::text As geom_colname
FROM observatory.obs_column_table As geoid_ct,
observatory.obs_table As geom_t,
observatory.obs_column_table As geom_ct,