2015-11-11 02:27:05 +08:00
|
|
|
-- Check that the public function is callable, even with no data
|
|
|
|
-- It should return NULL
|
2015-12-03 18:03:10 +08:00
|
|
|
SELECT cdb_geocoder_server.cdb_geocode_admin0_polygon('test_user', 'test_orgname', 'Spain');
|
2015-11-24 20:30:18 +08:00
|
|
|
cdb_geocode_admin0_polygon
|
|
|
|
----------------------------
|
2015-11-11 02:27:05 +08:00
|
|
|
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
-- Insert some dummy synonym
|
|
|
|
INSERT INTO admin0_synonyms (name, adm0_a3) VALUES ('Spain', 'ESP');
|
|
|
|
-- Insert some dummy geometry to return
|
|
|
|
INSERT INTO ne_admin0_v3 (adm0_a3, the_geom) VALUES('ESP', ST_GeomFromText(
|
|
|
|
'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
|
2015-12-03 18:03:10 +08:00
|
|
|
SELECT cdb_geocoder_server.cdb_geocode_admin0_polygon('test_user', 'test_orgname', 'Spain');
|
2015-11-24 20:30:18 +08:00
|
|
|
cdb_geocode_admin0_polygon
|
2015-11-11 02:27:05 +08:00
|
|
|
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
0103000020E61000000100000004000000D0EA37A29AC651C00FD603035B284540FEFCFB379AC651C0C0503E9F5B284540FFDDDD4D96C651C033AC3B284F284540D0EA37A29AC651C00FD603035B284540
|
|
|
|
(1 row)
|
|
|
|
|
2015-11-23 18:48:24 +08:00
|
|
|
-- Check for admin0 signatures
|
|
|
|
SELECT exists(SELECT *
|
|
|
|
FROM pg_proc p
|
|
|
|
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
|
|
|
WHERE ns.nspname = 'cdb_geocoder_server'
|
2015-11-24 20:30:18 +08:00
|
|
|
AND proname = 'cdb_geocode_admin0_polygon'
|
2015-12-03 18:03:10 +08:00
|
|
|
AND oidvectortypes(p.proargtypes) = 'text, text, text');
|
2015-11-23 18:48:24 +08:00
|
|
|
exists
|
|
|
|
--------
|
|
|
|
t
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
SELECT exists(SELECT *
|
|
|
|
FROM pg_proc p
|
|
|
|
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
|
|
|
WHERE ns.nspname = 'cdb_geocoder_server'
|
2015-11-24 20:30:18 +08:00
|
|
|
AND proname = '_cdb_geocode_admin0_polygon'
|
2015-11-23 18:48:24 +08:00
|
|
|
AND oidvectortypes(p.proargtypes) = 'text');
|
|
|
|
exists
|
|
|
|
--------
|
|
|
|
t
|
|
|
|
(1 row)
|
|
|
|
|