2015-11-11 23:29:17 +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_namedplace_point('test_user', 'test_orgname', 'Elx');
|
2015-11-24 20:30:18 +08:00
|
|
|
cdb_geocode_namedplace_point
|
|
|
|
------------------------------
|
2015-11-12 18:38:39 +08:00
|
|
|
|
|
|
|
(1 row)
|
|
|
|
|
2016-02-06 00:57:22 +08:00
|
|
|
SELECT cdb_dataservices_server.cdb_geocode_namedplace_point('test_user', 'test_orgname', 'Elx', 'Spain');
|
2015-11-24 20:30:18 +08:00
|
|
|
cdb_geocode_namedplace_point
|
|
|
|
------------------------------
|
2015-11-12 18:38:39 +08:00
|
|
|
|
|
|
|
(1 row)
|
|
|
|
|
2016-02-06 00:57:22 +08:00
|
|
|
SELECT cdb_dataservices_server.cdb_geocode_namedplace_point('test_user', 'test_orgname', 'Elx', 'Valencia', 'Spain');
|
2015-11-24 20:30:18 +08:00
|
|
|
cdb_geocode_namedplace_point
|
|
|
|
------------------------------
|
2015-11-12 18:38:39 +08:00
|
|
|
|
|
|
|
(1 row)
|
|
|
|
|
2015-11-11 23:29:17 +08:00
|
|
|
-- Insert dummy data into points table
|
2015-11-12 01:14:22 +08:00
|
|
|
INSERT INTO global_cities_points_limited (geoname_id, name, iso2, admin1, admin2, population, lowername, the_geom) VALUES (3128760, 'Elche', 'ES', 'Valencia', 'AL', 34534, 'elche', ST_GeomFromText(
|
2015-11-11 23:29:17 +08:00
|
|
|
'POINT(0.6983 39.26787)',4326)
|
|
|
|
);
|
|
|
|
-- Insert dummy data into alternates table
|
2015-11-12 01:14:22 +08:00
|
|
|
INSERT INTO global_cities_alternates_limited (geoname_id, name, preferred, lowername, admin1_geonameid, iso2, admin1, the_geom) VALUES (3128760, 'Elx', true, 'elx', '000000', 'ES', 'Valencia', ST_GeomFromText(
|
2015-11-11 23:29:17 +08:00
|
|
|
'POINT(0.6983 39.26787)',4326)
|
|
|
|
);
|
2015-11-12 00:17:18 +08:00
|
|
|
-- Insert dummy data into country decoder table
|
|
|
|
INSERT INTO country_decoder (synonyms, iso2) VALUES (Array['spain'], 'ES');
|
2015-11-12 01:14:22 +08:00
|
|
|
-- Insert dummy data into admin1 decoder table
|
|
|
|
INSERT INTO admin1_decoder (admin1, synonyms, iso2) VALUES ('Valencia', Array['valencia', 'Valencia'], 'ES');
|
2015-11-11 23:29:17 +08:00
|
|
|
-- This should return the point inserted above
|
2016-02-06 00:57:22 +08:00
|
|
|
SELECT cdb_dataservices_server.cdb_geocode_namedplace_point('test_user', 'test_orgname', 'Elx');
|
2015-11-24 20:30:18 +08:00
|
|
|
cdb_geocode_namedplace_point
|
2015-11-11 23:29:17 +08:00
|
|
|
----------------------------------------------------
|
|
|
|
0101000020E6100000637FD93D7958E63F2ECA6C9049A24340
|
|
|
|
(1 row)
|
|
|
|
|
2016-02-06 00:57:22 +08:00
|
|
|
SELECT cdb_dataservices_server.cdb_geocode_namedplace_point('test_user', 'test_orgname', 'Elche');
|
2015-11-24 20:30:18 +08:00
|
|
|
cdb_geocode_namedplace_point
|
2015-11-11 23:29:17 +08:00
|
|
|
----------------------------------------------------
|
|
|
|
0101000020E6100000637FD93D7958E63F2ECA6C9049A24340
|
|
|
|
(1 row)
|
|
|
|
|
2016-02-06 00:57:22 +08:00
|
|
|
SELECT cdb_dataservices_server.cdb_geocode_namedplace_point('test_user', 'test_orgname', 'Elx', 'Spain');
|
2015-11-24 20:30:18 +08:00
|
|
|
cdb_geocode_namedplace_point
|
2015-11-12 00:17:18 +08:00
|
|
|
----------------------------------------------------
|
|
|
|
0101000020E6100000637FD93D7958E63F2ECA6C9049A24340
|
|
|
|
(1 row)
|
|
|
|
|
2016-02-06 00:57:22 +08:00
|
|
|
SELECT cdb_dataservices_server.cdb_geocode_namedplace_point('test_user', 'test_orgname', 'Elche', 'Spain');
|
2015-11-24 20:30:18 +08:00
|
|
|
cdb_geocode_namedplace_point
|
2015-11-12 00:17:18 +08:00
|
|
|
----------------------------------------------------
|
|
|
|
0101000020E6100000637FD93D7958E63F2ECA6C9049A24340
|
|
|
|
(1 row)
|
|
|
|
|
2016-02-06 00:57:22 +08:00
|
|
|
SELECT cdb_dataservices_server.cdb_geocode_namedplace_point('test_user', 'test_orgname', 'Elx', 'Valencia', 'Spain');
|
2015-11-24 20:30:18 +08:00
|
|
|
cdb_geocode_namedplace_point
|
2015-11-12 01:14:22 +08:00
|
|
|
----------------------------------------------------
|
|
|
|
0101000020E6100000637FD93D7958E63F2ECA6C9049A24340
|
|
|
|
(1 row)
|
|
|
|
|
2016-02-06 00:57:22 +08:00
|
|
|
SELECT cdb_dataservices_server.cdb_geocode_namedplace_point('test_user', 'test_orgname', 'Elche', 'valencia', 'Spain');
|
2015-11-24 20:30:18 +08:00
|
|
|
cdb_geocode_namedplace_point
|
2015-11-12 01:14:22 +08:00
|
|
|
----------------------------------------------------
|
|
|
|
0101000020E6100000637FD93D7958E63F2ECA6C9049A24340
|
|
|
|
(1 row)
|
|
|
|
|
2015-11-23 18:48:24 +08:00
|
|
|
-- Check for namedplaces 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_namedplace_point'
|
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)
|
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_namedplace_point'
|
2015-12-03 18:03:10 +08:00
|
|
|
AND oidvectortypes(p.proargtypes) = 'text, 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)
|
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_namedplace_point'
|
2015-12-03 18:03:10 +08:00
|
|
|
AND oidvectortypes(p.proargtypes) = 'text, 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)
|
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_namedplace_point'
|
2015-11-23 18:48:24 +08:00
|
|
|
AND oidvectortypes(p.proargtypes) = 'text');
|
|
|
|
exists
|
|
|
|
--------
|
|
|
|
t
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
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_namedplace_point'
|
2015-11-23 18:48:24 +08:00
|
|
|
AND oidvectortypes(p.proargtypes) = 'text, text');
|
|
|
|
exists
|
|
|
|
--------
|
|
|
|
t
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
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_namedplace_point'
|
2015-11-23 18:48:24 +08:00
|
|
|
AND oidvectortypes(p.proargtypes) = 'text, text, text');
|
|
|
|
exists
|
|
|
|
--------
|
|
|
|
t
|
|
|
|
(1 row)
|
|
|
|
|