Use schema explicitly from within extension
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
-- TODO probably needs to take in the column_id array to get the relevant
|
||||
-- table where there is multiple sources for a column from multiple
|
||||
-- geometries.
|
||||
CREATE OR REPLACE FUNCTION OBS_GeomTable(
|
||||
CREATE OR REPLACE FUNCTION cdb_observatory.OBS_GeomTable(
|
||||
geom geometry,
|
||||
geometry_id text
|
||||
)
|
||||
@@ -34,20 +34,20 @@ END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
-- A type for use with the OBS_GetColumnData function
|
||||
CREATE TYPE OBS_ColumnData AS (colname text, tablename text, aggregate text);
|
||||
CREATE TYPE cdb_observatory.OBS_ColumnData AS (colname text, tablename text, aggregate text);
|
||||
|
||||
|
||||
-- A function that gets the column data for multiple columns
|
||||
-- Old: OBS_GetColumnData
|
||||
CREATE OR REPLACE FUNCTION OBS_GetColumnData(
|
||||
CREATE OR REPLACE FUNCTION cdb_observatory.OBS_GetColumnData(
|
||||
geometry_id text,
|
||||
column_ids text[],
|
||||
timespan text
|
||||
)
|
||||
RETURNS OBS_ColumnData[]
|
||||
RETURNS cdb_observatory.OBS_ColumnData[]
|
||||
AS $$
|
||||
DECLARE
|
||||
result OBS_ColumnData[];
|
||||
result cdb_observatory.OBS_ColumnData[];
|
||||
BEGIN
|
||||
EXECUTE '
|
||||
WITH geomref AS (
|
||||
@@ -60,7 +60,7 @@ BEGIN
|
||||
column_ids as (
|
||||
select row_number() over () as no, a.column_id as column_id from (select unnest($2) as column_id) a
|
||||
)
|
||||
SELECT array_agg(ROW(colname, tablename, aggregate)::OBS_ColumnData order by column_ids.no)
|
||||
SELECT array_agg(ROW(colname, tablename, aggregate)::cdb_observatory.OBS_ColumnData order by column_ids.no)
|
||||
FROM column_ids, observatory.OBS_column c, observatory.OBS_column_table ct, observatory.OBS_table t
|
||||
WHERE column_ids.column_id = c.id
|
||||
AND c.id = ct.column_id
|
||||
@@ -78,7 +78,7 @@ $$ LANGUAGE plpgsql;
|
||||
--Gets the column id for a census variable given a human readable version of it
|
||||
-- Old: OBS_LOOKUP_CENSUS_HUMAN
|
||||
|
||||
CREATE OR REPLACE FUNCTION OBS_LookupCensusHuman(
|
||||
CREATE OR REPLACE FUNCTION cdb_observatory.OBS_LookupCensusHuman(
|
||||
column_names text[],
|
||||
-- TODO: change variable name table_name to table_id
|
||||
table_name text DEFAULT '"us.census.acs".extract_block_group_5yr_2013_69b156927c'
|
||||
@@ -107,7 +107,7 @@ $$ LANGUAGE plpgsql;
|
||||
|
||||
|
||||
--Test point cause Stuart always seems to make random points in the water
|
||||
CREATE OR REPLACE FUNCTION _TestPoint()
|
||||
CREATE OR REPLACE FUNCTION cdb_observatory._TestPoint()
|
||||
RETURNS geometry
|
||||
AS $$
|
||||
BEGIN
|
||||
@@ -118,7 +118,7 @@ $$ LANGUAGE plpgsql;
|
||||
|
||||
--Test polygon cause Stuart always seems to make random points in the water
|
||||
-- TODO: remove as it's not used anywhere?
|
||||
CREATE OR REPLACE FUNCTION _TestArea()
|
||||
CREATE OR REPLACE FUNCTION cdb_observatory._TestArea()
|
||||
RETURNS geometry
|
||||
AS $$
|
||||
BEGIN
|
||||
@@ -130,7 +130,7 @@ $$ LANGUAGE plpgsql;
|
||||
|
||||
--Used to expand a column based response to a table based one. Give it the desired
|
||||
--columns and it will return a partial query for rolling them out to a table.
|
||||
CREATE OR REPLACE FUNCTION OBS_BuildSnapshotQuery(names text[])
|
||||
CREATE OR REPLACE FUNCTION cdb_observatory.OBS_BuildSnapshotQuery(names text[])
|
||||
RETURNS TEXT
|
||||
AS $$
|
||||
DECLARE
|
||||
|
||||
Reference in New Issue
Block a user