change OBS_GetLegacyMetadata to return median/average measures too when called for polygons

This commit is contained in:
John Krauss
2017-03-01 16:03:14 +00:00
parent 71d891c067
commit bcbd8a2be4
4 changed files with 25 additions and 5 deletions

View File

@@ -369,8 +369,10 @@ RETURNS TABLE (
DECLARE
aggregate_condition TEXT DEFAULT '';
BEGIN
IF aggregate_type IS NOT NULL THEN
aggregate_condition := format(' AND numer_aggregate = %L ', aggregate_type);
IF LOWER(aggregate_type) ILIKE 'sum' THEN
aggregate_condition := ' AND numer_aggregate IN (''sum'', ''median'', ''average'') ';
ELSIF aggregate_type IS NOT NULL THEN
aggregate_condition := format(' AND numer_aggregate ILIKE %L ', aggregate_type);
END IF;
RETURN QUERY
EXECUTE format($string$