estimate average and median across arbitrary areas if universe is provided, otherwise return null and raise a notice. fixes #252

This commit is contained in:
John Krauss
2017-02-10 01:08:10 +00:00
parent 79c450f63f
commit 2edb850a45
5 changed files with 668 additions and 482 deletions

View File

@@ -205,6 +205,18 @@ END;
$$ LANGUAGE plpgsql;
-- Function we can call to raise an exception in the midst of a SQL statement
CREATE OR REPLACE FUNCTION cdb_observatory._OBS_RaiseNotice(
message TEXT
) RETURNS TEXT
AS $$
BEGIN
RAISE NOTICE '%', message;
RETURN NULL;
END;
$$ LANGUAGE plpgsql;
-- Create a function that always returns the first non-NULL item
CREATE OR REPLACE FUNCTION cdb_observatory.first_agg ( anyelement, anyelement )
RETURNS anyelement LANGUAGE SQL IMMUTABLE STRICT AS $$