2015-11-11 20:33:14 +08:00
|
|
|
-- Check that the public function is callable, even with no data
|
|
|
|
-- It should return NULL
|
2016-02-06 00:57:22 +08:00
|
|
|
SELECT cdb_dataservices_server.cdb_geocode_admin1_polygon('test_user', 'test_orgname', 'California');
|
|
|
|
SELECT cdb_dataservices_server.cdb_geocode_admin1_polygon('test_user', 'test_orgname', 'California', 'United States');
|
2015-11-11 21:05:17 +08:00
|
|
|
|
|
|
|
-- Insert dummy data into country decoder table
|
|
|
|
INSERT INTO country_decoder (synonyms, iso3) VALUES (Array['united states'], 'USA');
|
2015-11-11 20:33:14 +08:00
|
|
|
|
|
|
|
-- Insert some dummy data and geometry to return
|
2015-11-11 21:05:17 +08:00
|
|
|
INSERT INTO global_province_polygons (synonyms, iso3, the_geom) VALUES (Array['california'], 'USA', ST_GeomFromText(
|
2015-11-11 20:33:14 +08:00
|
|
|
'POLYGON((-71.1031880899493 42.3152774590236,
|
|
|
|
-71.1031627617667 42.3152960829043,
|
|
|
|
-71.102923838298 42.3149156848307,
|
|
|
|
-71.1031880899493 42.3152774590236))',4326)
|
|
|
|
);
|
|
|
|
|
|
|
|
-- This should return the polygon inserted above
|
2016-02-06 00:57:22 +08:00
|
|
|
SELECT cdb_dataservices_server.cdb_geocode_admin1_polygon('test_user', 'test_orgname', 'California');
|
|
|
|
SELECT cdb_dataservices_server.cdb_geocode_admin1_polygon('test_user', 'test_orgname', 'California', 'United States');
|
2015-11-23 18:48:24 +08:00
|
|
|
|
|
|
|
-- Check for admin1 signatures
|
|
|
|
SELECT exists(SELECT *
|
|
|
|
FROM pg_proc p
|
|
|
|
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
2016-02-06 00:57:22 +08:00
|
|
|
WHERE ns.nspname = 'cdb_dataservices_server'
|
2015-11-24 20:30:18 +08:00
|
|
|
AND proname = 'cdb_geocode_admin1_polygon'
|
2015-12-03 18:03:10 +08:00
|
|
|
AND oidvectortypes(p.proargtypes) = 'text, text, text');
|
2015-11-23 18:48:24 +08:00
|
|
|
|
|
|
|
SELECT exists(SELECT *
|
|
|
|
FROM pg_proc p
|
|
|
|
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
2016-02-06 00:57:22 +08:00
|
|
|
WHERE ns.nspname = 'cdb_dataservices_server'
|
2015-11-24 20:30:18 +08:00
|
|
|
AND proname = 'cdb_geocode_admin1_polygon'
|
2015-12-03 18:03:10 +08:00
|
|
|
AND oidvectortypes(p.proargtypes) = 'text, text, text, text');
|
2015-11-23 18:48:24 +08:00
|
|
|
|
|
|
|
SELECT exists(SELECT *
|
|
|
|
FROM pg_proc p
|
|
|
|
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
2016-02-06 00:57:22 +08:00
|
|
|
WHERE ns.nspname = 'cdb_dataservices_server'
|
2015-11-24 20:30:18 +08:00
|
|
|
AND proname = '_cdb_geocode_admin1_polygon'
|
2015-11-23 18:48:24 +08:00
|
|
|
AND oidvectortypes(p.proargtypes) = 'text');
|
|
|
|
|
|
|
|
SELECT exists(SELECT *
|
|
|
|
FROM pg_proc p
|
|
|
|
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
2016-02-06 00:57:22 +08:00
|
|
|
WHERE ns.nspname = 'cdb_dataservices_server'
|
2015-11-24 20:30:18 +08:00
|
|
|
AND proname = '_cdb_geocode_admin1_polygon'
|
2016-02-06 00:57:22 +08:00
|
|
|
AND oidvectortypes(p.proargtypes) = 'text, text');
|