adding null cases

This commit is contained in:
Andy Eschbacher
2016-04-14 14:52:23 -04:00
parent 4b6b311823
commit c434cacd10
2 changed files with 91 additions and 46 deletions

View File

@@ -21,9 +21,16 @@ SELECT
SELECT
cdb_observatory.OBS_GeomTable(
CDB_LatLng(40.7128,-74.0059),
'"us.census.tiger".nonexistant_id'
'"us.census.tiger".nonexistant_id' -- not in catalog
);
-- future test: give back nulls when geometry doesn't intersect
-- SELECT
-- cdb_observatory.OBS_GeomTable(
-- CDB_LatLng(0,0), -- should give back null since it's in the ocean?
-- '"us.census.tiger".census_tract'
-- );
-- OBS_GetColumnData
-- should give back:
-- colname | tablename | aggregate
@@ -38,6 +45,15 @@ SELECT
))).*
ORDER BY 1 ASC;
-- should be null-valued
SELECT
(unnest(cdb_observatory.OBS_GetColumnData(
'"us.census.tiger".census_tract',
Array['"us.census.tiger".baloney'], -- entry not in catalog
'2009 - 2013'
))).*
ORDER BY 1 ASC;
-- OBS_LookupCensusHuman
-- should give back: {"\"us.census.acs\".B19083001"}
SELECT
@@ -45,6 +61,12 @@ SELECT
Array['gini_index']
);
-- should be empty array
SELECT
cdb_observatory.OBS_LookupCensusHuman(
Array['cookies']
);
-- OBS_BuildSnapshotQuery
-- Should give back: SELECT vals[1] As total_pop, vals[2] As male_pop, vals[3] As female_pop, vals[4] As median_age
SELECT
@@ -52,4 +74,10 @@ SELECT
Array['total_pop','male_pop','female_pop','median_age']
);
-- should give back: SELECT vals[1] As mandarin_orange
SELECT
cdb_observatory.OBS_BuildSnapshotQuery(
Array['mandarin_orange']
);
\i test/sql/drop_fixtures.sql