fix fixture, test and function bugs

This commit is contained in:
John Krauss 2016-05-05 14:58:06 -04:00
parent 499eb6da62
commit e306408a6a
3 changed files with 5 additions and 17 deletions

View File

@ -24,7 +24,7 @@ BEGIN
AND coltable.column_id = col.id
AND coltable.table_id = tab.id
AND col.id = $1
AND CASE WHEN $2::TEXT IS NOT NULL THEN timespan ILIKE $2::TEXT ELSE TRUE END
AND CASE WHEN $3::TEXT IS NOT NULL THEN timespan ILIKE $3::TEXT ELSE TRUE END
ORDER BY timespan DESC LIMIT 1
)
'

View File

@ -2,7 +2,7 @@
SET client_min_messages TO WARNING;
\set ECHO none
_obs_geomtable
obs_a92e1111ad3177676471d66bb8036e6d057f271b
obs_fc050f0b8673cfe3c6aa1040f749eb40975691b7
(1 row)
_obs_geomtable

View File

@ -9,7 +9,7 @@ SELECT
cdb_observatory._OBS_GeomTable(
ST_SetSRID(ST_Point(-74.0059, 40.7128), 4326),
'us.census.tiger.census_tract',
'2013'
'2014'
);
-- get null for unknown geometry_id
@ -33,17 +33,6 @@ SELECT
-- -----------|-----------------|-----------
-- geoid | obs_{hex table} | null
-- total_pop | obs_{hex table} | sum
--WITH result as (
--SELECT
-- array_agg(a) expected from cdb_observatory._OBS_GetColumnData(
-- 'us.census.tiger.census_tract',
-- Array['us.census.tiger.census_tract_geoid', 'us.census.acs.B01001001'],
-- '2009 - 2013') a
--)
--select (expected)[1]::text = '{"colname":"geoid","tablename":"obs_d34555209878e8c4b37cf0b2b3d072ff129ec470","aggregate":null,"name":"US Census Tract Geoids","type":"Text","description":""}' as test_get_obs_column_with_geoid_and_census_1,
-- (expected)[2]::text = '{"colname":"geoid","tablename":"obs_ab038198aaab3f3cb055758638ee4de28ad70146","aggregate":null,"name":"US Census Tract Geoids","type":"Text","description":""}' as test_get_obs_column_with_geoid_and_census_2
--from result;
WITH result as (
SELECT
array_agg(a) expected from cdb_observatory._OBS_GetColumnData(
@ -51,11 +40,10 @@ SELECT
Array['us.census.tiger.census_tract_geoid', 'us.census.acs.B01001001'],
'2009 - 2013') a
)
select (expected)[1]::text as test_get_obs_column_with_geoid_and_census_1,
(expected)[2]::text as test_get_obs_column_with_geoid_and_census_2
select (expected)[1]::text = '{"colname":"geoid","tablename":"obs_d34555209878e8c4b37cf0b2b3d072ff129ec470","aggregate":null,"name":"US Census Tracts Geoids","type":"Text","description":null}' as test_get_obs_column_with_geoid_and_census_1,
(expected)[2]::text = '{"colname":"geoid","tablename":"obs_ab038198aaab3f3cb055758638ee4de28ad70146","aggregate":null,"name":"US Census Tracts Geoids","type":"Text","description":null}' as test_get_obs_column_with_geoid_and_census_2
from result;
-- should be null-valued
WITH result as (
SELECT