Added cdb_* prefix to all the functions
This commit is contained in:
parent
9880965d07
commit
97cab091b6
@ -33,3 +33,4 @@ CREATE SCHEMA cdb_geocoder_server;
|
||||
DROP ROLE IF EXISTS test_regular_user;
|
||||
CREATE ROLE test_regular_user;
|
||||
GRANT publicuser TO test_regular_user;
|
||||
ALTER ROLE test_regular_user SET search_path TO "$user",public,cartodb,cdb_geocoder_client;
|
||||
|
@ -1,18 +1,20 @@
|
||||
-- Add to the search path the schema
|
||||
SET search_path TO "$user",public,cartodb,cdb_geocoder_client;
|
||||
-- Mock the server function
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server.geocode_admin0_polygon(user_id name, user_config JSON, geocoder_config JSON, country_name text)
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_admin0_polygon(user_id name, user_config JSON, geocoder_config JSON, country_name text)
|
||||
RETURNS Geometry AS $$
|
||||
BEGIN
|
||||
RAISE NOTICE 'cdb_geocoder_server.geocode_admin0_polygon invoked with params (%, %, %, %)', user_id, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}' , country_name;
|
||||
RAISE NOTICE 'cdb_geocoder_server.cdb_geocode_admin0_polygon invoked with params (%, %, %, %)', user_id, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}' , country_name;
|
||||
RETURN NULL;
|
||||
END;
|
||||
$$ LANGUAGE 'plpgsql';
|
||||
-- Exercise the public and the proxied function
|
||||
SELECT cdb_geocoder_client.geocode_admin0_polygon('Spain');
|
||||
NOTICE: cdb_geocoder_client._geocode_admin0_polygon(4): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.geocode_admin0_polygon invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, Spain)
|
||||
CONTEXT: SQL statement "SELECT cdb_geocoder_client._geocode_admin0_polygon(session_user, user_config, geocoder_config, country_name)"
|
||||
PL/pgSQL function cdb_geocoder_client.geocode_admin0_polygon(text) line 12 at SQL statement
|
||||
geocode_admin0_polygon
|
||||
------------------------
|
||||
SELECT cdb_geocode_admin0_polygon('Spain');
|
||||
NOTICE: cdb_geocoder_client._cdb_geocode_admin0_polygon(4): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_admin0_polygon invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, Spain)
|
||||
CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_admin0_polygon(session_user, user_config, geocoder_config, country_name)"
|
||||
PL/pgSQL function cdb_geocode_admin0_polygon(text) line 12 at SQL statement
|
||||
cdb_geocode_admin0_polygon
|
||||
----------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
|
@ -1,34 +1,36 @@
|
||||
-- Add to the search path the schema
|
||||
SET search_path TO "$user",public,cartodb,cdb_geocoder_client;
|
||||
-- Mock the server functions
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server.geocode_admin1_polygon(user_id name, user_config JSON, geocoder_config JSON, admin1_name text)
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_admin1_polygon(user_id name, user_config JSON, geocoder_config JSON, admin1_name text)
|
||||
RETURNS Geometry AS $$
|
||||
BEGIN
|
||||
RAISE NOTICE 'cdb_geocoder_server.geocode_admin1_polygon invoked with params (%, %, %, %)', user_id, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', admin1_name;
|
||||
RAISE NOTICE 'cdb_geocoder_server.cdb_geocode_admin1_polygon invoked with params (%, %, %, %)', user_id, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', admin1_name;
|
||||
RETURN NULL;
|
||||
END;
|
||||
$$ LANGUAGE 'plpgsql';
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server.geocode_admin1_polygon(user_id name, user_config JSON, geocoder_config JSON, admin1_name text, country_name text)
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_admin1_polygon(user_id name, user_config JSON, geocoder_config JSON, admin1_name text, country_name text)
|
||||
RETURNS Geometry AS $$
|
||||
BEGIN
|
||||
RAISE NOTICE 'cdb_geocoder_server.geocode_admin1_polygon invoked with params (%, %, %, %, %)', user_id, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', admin1_name, country_name;
|
||||
RAISE NOTICE 'cdb_geocoder_server.cdb_geocode_admin1_polygon invoked with params (%, %, %, %, %)', user_id, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', admin1_name, country_name;
|
||||
RETURN NULL;
|
||||
END;
|
||||
$$ LANGUAGE 'plpgsql';
|
||||
-- Exercise the public and the proxied function
|
||||
SELECT cdb_geocoder_client.geocode_admin1_polygon('California');
|
||||
NOTICE: cdb_geocoder_client._geocode_admin1_polygon(4): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.geocode_admin1_polygon invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, California)
|
||||
CONTEXT: SQL statement "SELECT cdb_geocoder_client._geocode_admin1_polygon(session_user, user_config, geocoder_config, admin1_name)"
|
||||
PL/pgSQL function cdb_geocoder_client.geocode_admin1_polygon(text) line 12 at SQL statement
|
||||
geocode_admin1_polygon
|
||||
------------------------
|
||||
SELECT cdb_geocode_admin1_polygon('California');
|
||||
NOTICE: cdb_geocoder_client._cdb_geocode_admin1_polygon(4): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_admin1_polygon invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, California)
|
||||
CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_admin1_polygon(session_user, user_config, geocoder_config, admin1_name)"
|
||||
PL/pgSQL function cdb_geocode_admin1_polygon(text) line 12 at SQL statement
|
||||
cdb_geocode_admin1_polygon
|
||||
----------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocoder_client.geocode_admin1_polygon('California', 'United States');
|
||||
NOTICE: cdb_geocoder_client._geocode_admin1_polygon(5): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.geocode_admin1_polygon invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, California, United States)
|
||||
CONTEXT: SQL statement "SELECT cdb_geocoder_client._geocode_admin1_polygon(session_user, user_config, geocoder_config, admin1_name, country_name)"
|
||||
PL/pgSQL function cdb_geocoder_client.geocode_admin1_polygon(text,text) line 12 at SQL statement
|
||||
geocode_admin1_polygon
|
||||
------------------------
|
||||
SELECT cdb_geocode_admin1_polygon('California', 'United States');
|
||||
NOTICE: cdb_geocoder_client._cdb_geocode_admin1_polygon(5): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_admin1_polygon invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, California, United States)
|
||||
CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_admin1_polygon(session_user, user_config, geocoder_config, admin1_name, country_name)"
|
||||
PL/pgSQL function cdb_geocode_admin1_polygon(text,text) line 12 at SQL statement
|
||||
cdb_geocode_admin1_polygon
|
||||
----------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
|
@ -1,50 +1,52 @@
|
||||
-- Add to the search path the schema
|
||||
SET search_path TO "$user",public,cartodb,cdb_geocoder_client;
|
||||
-- Mock the server functions
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server.geocode_namedplace_point(user_id name, user_config JSON, geocoder_config JSON, city_name text)
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_namedplace_point(user_id name, user_config JSON, geocoder_config JSON, city_name text)
|
||||
RETURNS Geometry AS $$
|
||||
BEGIN
|
||||
RAISE NOTICE 'cdb_geocoder_server.geocode_namedplace_point invoked with params (%, %, %, %)', user_id, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', city_name;
|
||||
RAISE NOTICE 'cdb_geocoder_server.cdb_geocode_namedplace_point invoked with params (%, %, %, %)', user_id, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', city_name;
|
||||
RETURN NULL;
|
||||
END;
|
||||
$$ LANGUAGE 'plpgsql';
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server.geocode_namedplace_point(user_id name, user_config JSON, geocoder_config JSON, city_name text, country_name text)
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_namedplace_point(user_id name, user_config JSON, geocoder_config JSON, city_name text, country_name text)
|
||||
RETURNS Geometry AS $$
|
||||
BEGIN
|
||||
RAISE NOTICE 'cdb_geocoder_server.geocode_namedplace_point invoked with params (%, %, %, %, %)', user_id, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', city_name, country_name;
|
||||
RAISE NOTICE 'cdb_geocoder_server.cdb_geocode_namedplace_point invoked with params (%, %, %, %, %)', user_id, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', city_name, country_name;
|
||||
RETURN NULL;
|
||||
END;
|
||||
$$ LANGUAGE 'plpgsql';
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server.geocode_namedplace_point(user_id name, user_config JSON, geocoder_config JSON, city_name text, admin1_name text, country_name text)
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_namedplace_point(user_id name, user_config JSON, geocoder_config JSON, city_name text, admin1_name text, country_name text)
|
||||
RETURNS Geometry AS $$
|
||||
BEGIN
|
||||
RAISE NOTICE 'cdb_geocoder_server.geocode_namedplace_point invoked with params (%, %, %, %, %, %)', user_id, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', city_name, admin1_name, country_name;
|
||||
RAISE NOTICE 'cdb_geocoder_server.cdb_geocode_namedplace_point invoked with params (%, %, %, %, %, %)', user_id, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', city_name, admin1_name, country_name;
|
||||
RETURN NULL;
|
||||
END;
|
||||
$$ LANGUAGE 'plpgsql';
|
||||
-- Exercise the public and the proxied function
|
||||
SELECT cdb_geocoder_client.geocode_namedplace_point('Elx');
|
||||
NOTICE: cdb_geocoder_client._geocode_namedplace_point(4): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.geocode_namedplace_point invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, Elx)
|
||||
CONTEXT: SQL statement "SELECT cdb_geocoder_client._geocode_namedplace_point(session_user, user_config, geocoder_config, city_name)"
|
||||
PL/pgSQL function cdb_geocoder_client.geocode_namedplace_point(text) line 12 at SQL statement
|
||||
geocode_namedplace_point
|
||||
--------------------------
|
||||
SELECT cdb_geocode_namedplace_point('Elx');
|
||||
NOTICE: cdb_geocoder_client._cdb_geocode_namedplace_point(4): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_namedplace_point invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, Elx)
|
||||
CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_namedplace_point(session_user, user_config, geocoder_config, city_name)"
|
||||
PL/pgSQL function cdb_geocode_namedplace_point(text) line 12 at SQL statement
|
||||
cdb_geocode_namedplace_point
|
||||
------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocoder_client.geocode_namedplace_point('Elx', 'Spain');
|
||||
NOTICE: cdb_geocoder_client._geocode_namedplace_point(5): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.geocode_namedplace_point invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, Elx, Spain)
|
||||
CONTEXT: SQL statement "SELECT cdb_geocoder_client._geocode_namedplace_point(session_user, user_config, geocoder_config, city_name, country_name)"
|
||||
PL/pgSQL function cdb_geocoder_client.geocode_namedplace_point(text,text) line 12 at SQL statement
|
||||
geocode_namedplace_point
|
||||
--------------------------
|
||||
SELECT cdb_geocode_namedplace_point('Elx', 'Spain');
|
||||
NOTICE: cdb_geocoder_client._cdb_geocode_namedplace_point(5): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_namedplace_point invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, Elx, Spain)
|
||||
CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_namedplace_point(session_user, user_config, geocoder_config, city_name, country_name)"
|
||||
PL/pgSQL function cdb_geocode_namedplace_point(text,text) line 12 at SQL statement
|
||||
cdb_geocode_namedplace_point
|
||||
------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocoder_client.geocode_namedplace_point('Elx', 'Valencia', 'Spain');
|
||||
NOTICE: cdb_geocoder_client._geocode_namedplace_point(6): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.geocode_namedplace_point invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, Elx, Valencia, Spain)
|
||||
CONTEXT: SQL statement "SELECT cdb_geocoder_client._geocode_namedplace_point(session_user, user_config, geocoder_config, city_name, admin1_name, country_name)"
|
||||
PL/pgSQL function cdb_geocoder_client.geocode_namedplace_point(text,text,text) line 12 at SQL statement
|
||||
geocode_namedplace_point
|
||||
--------------------------
|
||||
SELECT cdb_geocode_namedplace_point('Elx', 'Valencia', 'Spain');
|
||||
NOTICE: cdb_geocoder_client._cdb_geocode_namedplace_point(6): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_namedplace_point invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, Elx, Valencia, Spain)
|
||||
CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_namedplace_point(session_user, user_config, geocoder_config, city_name, admin1_name, country_name)"
|
||||
PL/pgSQL function cdb_geocode_namedplace_point(text,text,text) line 12 at SQL statement
|
||||
cdb_geocode_namedplace_point
|
||||
------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
|
@ -1,34 +1,36 @@
|
||||
-- Add to the search path the schema
|
||||
SET search_path TO "$user",public,cartodb,cdb_geocoder_client;
|
||||
-- Mock the server functions
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server.geocode_postalcode_polygon(user_id name, user_config JSON, geocoder_config JSON, postal_code text, country_name text)
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_postalcode_polygon(user_id name, user_config JSON, geocoder_config JSON, postal_code text, country_name text)
|
||||
RETURNS Geometry AS $$
|
||||
BEGIN
|
||||
RAISE NOTICE 'cdb_geocoder_server.geocode_postalcode_polygon invoked with params (%, %, %, %, %)', user_id, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', postal_code, country_name;
|
||||
RAISE NOTICE 'cdb_geocoder_server.cdb_geocode_postalcode_polygon invoked with params (%, %, %, %, %)', user_id, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', postal_code, country_name;
|
||||
RETURN NULL;
|
||||
END;
|
||||
$$ LANGUAGE 'plpgsql';
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server.geocode_postalcode_point(user_id name, user_config JSON, geocoder_config JSON, postal_code text, country_name text)
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_postalcode_point(user_id name, user_config JSON, geocoder_config JSON, postal_code text, country_name text)
|
||||
RETURNS Geometry AS $$
|
||||
BEGIN
|
||||
RAISE NOTICE 'cdb_geocoder_server.geocode_postalcode_point invoked with params (%, %, %, %, %)', user_id, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', postal_code, country_name;
|
||||
RAISE NOTICE 'cdb_geocoder_server.cdb_geocode_postalcode_point invoked with params (%, %, %, %, %)', user_id, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', postal_code, country_name;
|
||||
RETURN NULL;
|
||||
END;
|
||||
$$ LANGUAGE 'plpgsql';
|
||||
-- Exercise the public and the proxied function
|
||||
SELECT cdb_geocoder_client.geocode_postalcode_polygon('03204', 'Spain');
|
||||
NOTICE: cdb_geocoder_client._geocode_postalcode_polygon(5): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.geocode_postalcode_polygon invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, 03204, Spain)
|
||||
CONTEXT: SQL statement "SELECT cdb_geocoder_client._geocode_postalcode_polygon(session_user, user_config, geocoder_config, postal_code, country_name)"
|
||||
PL/pgSQL function cdb_geocoder_client.geocode_postalcode_polygon(text,text) line 12 at SQL statement
|
||||
geocode_postalcode_polygon
|
||||
----------------------------
|
||||
SELECT cdb_geocode_postalcode_polygon('03204', 'Spain');
|
||||
NOTICE: cdb_geocoder_client._cdb_geocode_postalcode_polygon(5): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_postalcode_polygon invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, 03204, Spain)
|
||||
CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_postalcode_polygon(session_user, user_config, geocoder_config, postal_code, country_name)"
|
||||
PL/pgSQL function cdb_geocode_postalcode_polygon(text,text) line 12 at SQL statement
|
||||
cdb_geocode_postalcode_polygon
|
||||
--------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocoder_client.geocode_postalcode_point('03204', 'Spain');
|
||||
NOTICE: cdb_geocoder_client._geocode_postalcode_point(5): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.geocode_postalcode_point invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, 03204, Spain)
|
||||
CONTEXT: SQL statement "SELECT cdb_geocoder_client._geocode_postalcode_point(session_user, user_config, geocoder_config, postal_code, country_name)"
|
||||
PL/pgSQL function cdb_geocoder_client.geocode_postalcode_point(text,text) line 12 at SQL statement
|
||||
geocode_postalcode_point
|
||||
--------------------------
|
||||
SELECT cdb_geocode_postalcode_point('03204', 'Spain');
|
||||
NOTICE: cdb_geocoder_client._cdb_geocode_postalcode_point(5): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_postalcode_point invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, 03204, Spain)
|
||||
CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_postalcode_point(session_user, user_config, geocoder_config, postal_code, country_name)"
|
||||
PL/pgSQL function cdb_geocode_postalcode_point(text,text) line 12 at SQL statement
|
||||
cdb_geocode_postalcode_point
|
||||
------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
|
@ -1,18 +1,20 @@
|
||||
-- Add to the search path the schema
|
||||
SET search_path TO "$user",public,cartodb,cdb_geocoder_client;
|
||||
-- Mock the server functions
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server.geocode_ipaddress_point(user_id name, user_config JSON, geocoder_config JSON, ip_address text)
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_ipaddress_point(user_id name, user_config JSON, geocoder_config JSON, ip_address text)
|
||||
RETURNS Geometry AS $$
|
||||
BEGIN
|
||||
RAISE NOTICE 'cdb_geocoder_server.geocode_ipaddress_point invoked with params (%, %, %, %)', user_id, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', ip_address;
|
||||
RAISE NOTICE 'cdb_geocoder_server.cdb_geocode_ipaddress_point invoked with params (%, %, %, %)', user_id, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', ip_address;
|
||||
RETURN NULL;
|
||||
END;
|
||||
$$ LANGUAGE 'plpgsql';
|
||||
-- Exercise the public and the proxied function
|
||||
SELECT cdb_geocoder_client.geocode_ipaddress_point('8.8.8.8');
|
||||
NOTICE: cdb_geocoder_client._geocode_ipaddress_point(4): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.geocode_ipaddress_point invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, 8.8.8.8)
|
||||
CONTEXT: SQL statement "SELECT cdb_geocoder_client._geocode_ipaddress_point(session_user, user_config, geocoder_config, ip_address)"
|
||||
PL/pgSQL function cdb_geocoder_client.geocode_ipaddress_point(text) line 12 at SQL statement
|
||||
geocode_ipaddress_point
|
||||
-------------------------
|
||||
SELECT cdb_geocode_ipaddress_point('8.8.8.8');
|
||||
NOTICE: cdb_geocoder_client._cdb_geocode_ipaddress_point(4): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_ipaddress_point invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, 8.8.8.8)
|
||||
CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_ipaddress_point(session_user, user_config, geocoder_config, ip_address)"
|
||||
PL/pgSQL function cdb_geocode_ipaddress_point(text) line 12 at SQL statement
|
||||
cdb_geocode_ipaddress_point
|
||||
-----------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
|
@ -1,104 +1,106 @@
|
||||
-- Use regular user role
|
||||
SET ROLE test_regular_user;
|
||||
-- Add to the search path the schema
|
||||
SET search_path TO "$user",public,cartodb,cdb_geocoder_client;
|
||||
-- Exercise the public function
|
||||
-- it is public, it shall work
|
||||
SELECT cdb_geocoder_client.geocode_admin0_polygon('Spain');
|
||||
NOTICE: cdb_geocoder_client._geocode_admin0_polygon(4): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.geocode_admin0_polygon invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, Spain)
|
||||
CONTEXT: SQL statement "SELECT cdb_geocoder_client._geocode_admin0_polygon(session_user, user_config, geocoder_config, country_name)"
|
||||
PL/pgSQL function cdb_geocoder_client.geocode_admin0_polygon(text) line 12 at SQL statement
|
||||
geocode_admin0_polygon
|
||||
------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocoder_client.geocode_admin1_polygon('California');
|
||||
NOTICE: cdb_geocoder_client._geocode_admin1_polygon(4): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.geocode_admin1_polygon invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, California)
|
||||
CONTEXT: SQL statement "SELECT cdb_geocoder_client._geocode_admin1_polygon(session_user, user_config, geocoder_config, admin1_name)"
|
||||
PL/pgSQL function cdb_geocoder_client.geocode_admin1_polygon(text) line 12 at SQL statement
|
||||
geocode_admin1_polygon
|
||||
------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocoder_client.geocode_admin1_polygon('California', 'United States');
|
||||
NOTICE: cdb_geocoder_client._geocode_admin1_polygon(5): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.geocode_admin1_polygon invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, California, United States)
|
||||
CONTEXT: SQL statement "SELECT cdb_geocoder_client._geocode_admin1_polygon(session_user, user_config, geocoder_config, admin1_name, country_name)"
|
||||
PL/pgSQL function cdb_geocoder_client.geocode_admin1_polygon(text,text) line 12 at SQL statement
|
||||
geocode_admin1_polygon
|
||||
------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocoder_client.geocode_namedplace_point('Elx');
|
||||
NOTICE: cdb_geocoder_client._geocode_namedplace_point(4): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.geocode_namedplace_point invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, Elx)
|
||||
CONTEXT: SQL statement "SELECT cdb_geocoder_client._geocode_namedplace_point(session_user, user_config, geocoder_config, city_name)"
|
||||
PL/pgSQL function cdb_geocoder_client.geocode_namedplace_point(text) line 12 at SQL statement
|
||||
geocode_namedplace_point
|
||||
--------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocoder_client.geocode_namedplace_point('Elx', 'Valencia');
|
||||
NOTICE: cdb_geocoder_client._geocode_namedplace_point(5): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.geocode_namedplace_point invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, Elx, Valencia)
|
||||
CONTEXT: SQL statement "SELECT cdb_geocoder_client._geocode_namedplace_point(session_user, user_config, geocoder_config, city_name, country_name)"
|
||||
PL/pgSQL function cdb_geocoder_client.geocode_namedplace_point(text,text) line 12 at SQL statement
|
||||
geocode_namedplace_point
|
||||
--------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocoder_client.geocode_namedplace_point('Elx', 'Valencia', 'Spain');
|
||||
NOTICE: cdb_geocoder_client._geocode_namedplace_point(6): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.geocode_namedplace_point invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, Elx, Valencia, Spain)
|
||||
CONTEXT: SQL statement "SELECT cdb_geocoder_client._geocode_namedplace_point(session_user, user_config, geocoder_config, city_name, admin1_name, country_name)"
|
||||
PL/pgSQL function cdb_geocoder_client.geocode_namedplace_point(text,text,text) line 12 at SQL statement
|
||||
geocode_namedplace_point
|
||||
--------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocoder_client.geocode_postalcode_polygon('03204', 'Spain');
|
||||
NOTICE: cdb_geocoder_client._geocode_postalcode_polygon(5): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.geocode_postalcode_polygon invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, 03204, Spain)
|
||||
CONTEXT: SQL statement "SELECT cdb_geocoder_client._geocode_postalcode_polygon(session_user, user_config, geocoder_config, postal_code, country_name)"
|
||||
PL/pgSQL function cdb_geocoder_client.geocode_postalcode_polygon(text,text) line 12 at SQL statement
|
||||
geocode_postalcode_polygon
|
||||
SELECT cdb_geocode_admin0_polygon('Spain');
|
||||
NOTICE: cdb_geocoder_client._cdb_geocode_admin0_polygon(4): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_admin0_polygon invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, Spain)
|
||||
CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_admin0_polygon(session_user, user_config, geocoder_config, country_name)"
|
||||
PL/pgSQL function cdb_geocode_admin0_polygon(text) line 12 at SQL statement
|
||||
cdb_geocode_admin0_polygon
|
||||
----------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocoder_client.geocode_postalcode_point('03204', 'Spain');
|
||||
NOTICE: cdb_geocoder_client._geocode_postalcode_point(5): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.geocode_postalcode_point invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, 03204, Spain)
|
||||
CONTEXT: SQL statement "SELECT cdb_geocoder_client._geocode_postalcode_point(session_user, user_config, geocoder_config, postal_code, country_name)"
|
||||
PL/pgSQL function cdb_geocoder_client.geocode_postalcode_point(text,text) line 12 at SQL statement
|
||||
geocode_postalcode_point
|
||||
--------------------------
|
||||
SELECT cdb_geocode_admin1_polygon('California');
|
||||
NOTICE: cdb_geocoder_client._cdb_geocode_admin1_polygon(4): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_admin1_polygon invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, California)
|
||||
CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_admin1_polygon(session_user, user_config, geocoder_config, admin1_name)"
|
||||
PL/pgSQL function cdb_geocode_admin1_polygon(text) line 12 at SQL statement
|
||||
cdb_geocode_admin1_polygon
|
||||
----------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocoder_client.geocode_ipaddress_point('8.8.8.8');
|
||||
NOTICE: cdb_geocoder_client._geocode_ipaddress_point(4): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.geocode_ipaddress_point invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, 8.8.8.8)
|
||||
CONTEXT: SQL statement "SELECT cdb_geocoder_client._geocode_ipaddress_point(session_user, user_config, geocoder_config, ip_address)"
|
||||
PL/pgSQL function cdb_geocoder_client.geocode_ipaddress_point(text) line 12 at SQL statement
|
||||
geocode_ipaddress_point
|
||||
-------------------------
|
||||
SELECT cdb_geocode_admin1_polygon('California', 'United States');
|
||||
NOTICE: cdb_geocoder_client._cdb_geocode_admin1_polygon(5): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_admin1_polygon invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, California, United States)
|
||||
CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_admin1_polygon(session_user, user_config, geocoder_config, admin1_name, country_name)"
|
||||
PL/pgSQL function cdb_geocode_admin1_polygon(text,text) line 12 at SQL statement
|
||||
cdb_geocode_admin1_polygon
|
||||
----------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocode_namedplace_point('Elx');
|
||||
NOTICE: cdb_geocoder_client._cdb_geocode_namedplace_point(4): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_namedplace_point invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, Elx)
|
||||
CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_namedplace_point(session_user, user_config, geocoder_config, city_name)"
|
||||
PL/pgSQL function cdb_geocode_namedplace_point(text) line 12 at SQL statement
|
||||
cdb_geocode_namedplace_point
|
||||
------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocode_namedplace_point('Elx', 'Valencia');
|
||||
NOTICE: cdb_geocoder_client._cdb_geocode_namedplace_point(5): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_namedplace_point invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, Elx, Valencia)
|
||||
CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_namedplace_point(session_user, user_config, geocoder_config, city_name, country_name)"
|
||||
PL/pgSQL function cdb_geocode_namedplace_point(text,text) line 12 at SQL statement
|
||||
cdb_geocode_namedplace_point
|
||||
------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocode_namedplace_point('Elx', 'Valencia', 'Spain');
|
||||
NOTICE: cdb_geocoder_client._cdb_geocode_namedplace_point(6): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_namedplace_point invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, Elx, Valencia, Spain)
|
||||
CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_namedplace_point(session_user, user_config, geocoder_config, city_name, admin1_name, country_name)"
|
||||
PL/pgSQL function cdb_geocode_namedplace_point(text,text,text) line 12 at SQL statement
|
||||
cdb_geocode_namedplace_point
|
||||
------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocode_postalcode_polygon('03204', 'Spain');
|
||||
NOTICE: cdb_geocoder_client._cdb_geocode_postalcode_polygon(5): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_postalcode_polygon invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, 03204, Spain)
|
||||
CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_postalcode_polygon(session_user, user_config, geocoder_config, postal_code, country_name)"
|
||||
PL/pgSQL function cdb_geocode_postalcode_polygon(text,text) line 12 at SQL statement
|
||||
cdb_geocode_postalcode_polygon
|
||||
--------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocode_postalcode_point('03204', 'Spain');
|
||||
NOTICE: cdb_geocoder_client._cdb_geocode_postalcode_point(5): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_postalcode_point invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, 03204, Spain)
|
||||
CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_postalcode_point(session_user, user_config, geocoder_config, postal_code, country_name)"
|
||||
PL/pgSQL function cdb_geocode_postalcode_point(text,text) line 12 at SQL statement
|
||||
cdb_geocode_postalcode_point
|
||||
------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocode_ipaddress_point('8.8.8.8');
|
||||
NOTICE: cdb_geocoder_client._cdb_geocode_ipaddress_point(4): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_ipaddress_point invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, 8.8.8.8)
|
||||
CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_ipaddress_point(session_user, user_config, geocoder_config, ip_address)"
|
||||
PL/pgSQL function cdb_geocode_ipaddress_point(text) line 12 at SQL statement
|
||||
cdb_geocode_ipaddress_point
|
||||
-----------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
-- Check the regular user has no permissions on private functions
|
||||
SELECT cdb_geocoder_client._geocode_admin0_polygon('evil_user', '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Hell');
|
||||
ERROR: permission denied for function _geocode_admin0_polygon
|
||||
SELECT cdb_geocoder_client._geocode_admin1_polygon('evil_user', '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Hell');
|
||||
ERROR: permission denied for function _geocode_admin1_polygon
|
||||
SELECT cdb_geocoder_client._geocode_admin1_polygon('evil_user', '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Sheol', 'Hell');
|
||||
ERROR: permission denied for function _geocode_admin1_polygon
|
||||
SELECT cdb_geocoder_client._geocode_namedplace_point('evil_user', '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Sheol');
|
||||
ERROR: permission denied for function _geocode_namedplace_point
|
||||
SELECT cdb_geocoder_client._geocode_namedplace_point('evil_user', '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Sheol', 'Hell');
|
||||
ERROR: permission denied for function _geocode_namedplace_point
|
||||
SELECT cdb_geocoder_client._geocode_namedplace_point('evil_user', '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Sheol', 'Hell', 'Ugly world');
|
||||
ERROR: permission denied for function _geocode_namedplace_point
|
||||
SELECT cdb_geocoder_client._geocode_postalcode_polygon('evil_user', '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', '66666', 'Hell');
|
||||
ERROR: permission denied for function _geocode_postalcode_polygon
|
||||
SELECT cdb_geocoder_client._geocode_postalcode_point('evil_user', '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', '66666', 'Hell');
|
||||
ERROR: permission denied for function _geocode_postalcode_point
|
||||
SELECT cdb_geocoder_client._geocode_ipaddress_point('evil_user', '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', '8.8.8.8');
|
||||
ERROR: permission denied for function _geocode_ipaddress_point
|
||||
SELECT _cdb_geocode_admin0_polygon('evil_user', '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Hell');
|
||||
ERROR: permission denied for function _cdb_geocode_admin0_polygon
|
||||
SELECT _cdb_geocode_admin1_polygon('evil_user', '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Hell');
|
||||
ERROR: permission denied for function _cdb_geocode_admin1_polygon
|
||||
SELECT _cdb_geocode_admin1_polygon('evil_user', '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Sheol', 'Hell');
|
||||
ERROR: permission denied for function _cdb_geocode_admin1_polygon
|
||||
SELECT _cdb_geocode_namedplace_point('evil_user', '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Sheol');
|
||||
ERROR: permission denied for function _cdb_geocode_namedplace_point
|
||||
SELECT _cdb_geocode_namedplace_point('evil_user', '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Sheol', 'Hell');
|
||||
ERROR: permission denied for function _cdb_geocode_namedplace_point
|
||||
SELECT _cdb_geocode_namedplace_point('evil_user', '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Sheol', 'Hell', 'Ugly world');
|
||||
ERROR: permission denied for function _cdb_geocode_namedplace_point
|
||||
SELECT _cdb_geocode_postalcode_polygon('evil_user', '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', '66666', 'Hell');
|
||||
ERROR: permission denied for function _cdb_geocode_postalcode_polygon
|
||||
SELECT _cdb_geocode_postalcode_point('evil_user', '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', '66666', 'Hell');
|
||||
ERROR: permission denied for function _cdb_geocode_postalcode_point
|
||||
SELECT _cdb_geocode_ipaddress_point('evil_user', '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', '8.8.8.8');
|
||||
ERROR: permission denied for function _cdb_geocode_ipaddress_point
|
||||
|
@ -22,3 +22,4 @@ CREATE SCHEMA cdb_geocoder_server;
|
||||
DROP ROLE IF EXISTS test_regular_user;
|
||||
CREATE ROLE test_regular_user;
|
||||
GRANT publicuser TO test_regular_user;
|
||||
ALTER ROLE test_regular_user SET search_path TO "$user",public,cartodb,cdb_geocoder_client;
|
@ -1,12 +1,15 @@
|
||||
-- Add to the search path the schema
|
||||
SET search_path TO "$user",public,cartodb,cdb_geocoder_client;
|
||||
|
||||
-- Mock the server function
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server.geocode_admin0_polygon(user_id name, user_config JSON, geocoder_config JSON, country_name text)
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_admin0_polygon(user_id name, user_config JSON, geocoder_config JSON, country_name text)
|
||||
RETURNS Geometry AS $$
|
||||
BEGIN
|
||||
RAISE NOTICE 'cdb_geocoder_server.geocode_admin0_polygon invoked with params (%, %, %, %)', user_id, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}' , country_name;
|
||||
RAISE NOTICE 'cdb_geocoder_server.cdb_geocode_admin0_polygon invoked with params (%, %, %, %)', user_id, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}' , country_name;
|
||||
RETURN NULL;
|
||||
END;
|
||||
$$ LANGUAGE 'plpgsql';
|
||||
|
||||
|
||||
-- Exercise the public and the proxied function
|
||||
SELECT cdb_geocoder_client.geocode_admin0_polygon('Spain');
|
||||
SELECT cdb_geocode_admin0_polygon('Spain');
|
||||
|
@ -1,21 +1,24 @@
|
||||
-- Add to the search path the schema
|
||||
SET search_path TO "$user",public,cartodb,cdb_geocoder_client;
|
||||
|
||||
-- Mock the server functions
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server.geocode_admin1_polygon(user_id name, user_config JSON, geocoder_config JSON, admin1_name text)
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_admin1_polygon(user_id name, user_config JSON, geocoder_config JSON, admin1_name text)
|
||||
RETURNS Geometry AS $$
|
||||
BEGIN
|
||||
RAISE NOTICE 'cdb_geocoder_server.geocode_admin1_polygon invoked with params (%, %, %, %)', user_id, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', admin1_name;
|
||||
RAISE NOTICE 'cdb_geocoder_server.cdb_geocode_admin1_polygon invoked with params (%, %, %, %)', user_id, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', admin1_name;
|
||||
RETURN NULL;
|
||||
END;
|
||||
$$ LANGUAGE 'plpgsql';
|
||||
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server.geocode_admin1_polygon(user_id name, user_config JSON, geocoder_config JSON, admin1_name text, country_name text)
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_admin1_polygon(user_id name, user_config JSON, geocoder_config JSON, admin1_name text, country_name text)
|
||||
RETURNS Geometry AS $$
|
||||
BEGIN
|
||||
RAISE NOTICE 'cdb_geocoder_server.geocode_admin1_polygon invoked with params (%, %, %, %, %)', user_id, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', admin1_name, country_name;
|
||||
RAISE NOTICE 'cdb_geocoder_server.cdb_geocode_admin1_polygon invoked with params (%, %, %, %, %)', user_id, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', admin1_name, country_name;
|
||||
RETURN NULL;
|
||||
END;
|
||||
$$ LANGUAGE 'plpgsql';
|
||||
|
||||
|
||||
-- Exercise the public and the proxied function
|
||||
SELECT cdb_geocoder_client.geocode_admin1_polygon('California');
|
||||
SELECT cdb_geocoder_client.geocode_admin1_polygon('California', 'United States');
|
||||
SELECT cdb_geocode_admin1_polygon('California');
|
||||
SELECT cdb_geocode_admin1_polygon('California', 'United States');
|
||||
|
@ -1,30 +1,33 @@
|
||||
-- Add to the search path the schema
|
||||
SET search_path TO "$user",public,cartodb,cdb_geocoder_client;
|
||||
|
||||
-- Mock the server functions
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server.geocode_namedplace_point(user_id name, user_config JSON, geocoder_config JSON, city_name text)
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_namedplace_point(user_id name, user_config JSON, geocoder_config JSON, city_name text)
|
||||
RETURNS Geometry AS $$
|
||||
BEGIN
|
||||
RAISE NOTICE 'cdb_geocoder_server.geocode_namedplace_point invoked with params (%, %, %, %)', user_id, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', city_name;
|
||||
RAISE NOTICE 'cdb_geocoder_server.cdb_geocode_namedplace_point invoked with params (%, %, %, %)', user_id, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', city_name;
|
||||
RETURN NULL;
|
||||
END;
|
||||
$$ LANGUAGE 'plpgsql';
|
||||
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server.geocode_namedplace_point(user_id name, user_config JSON, geocoder_config JSON, city_name text, country_name text)
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_namedplace_point(user_id name, user_config JSON, geocoder_config JSON, city_name text, country_name text)
|
||||
RETURNS Geometry AS $$
|
||||
BEGIN
|
||||
RAISE NOTICE 'cdb_geocoder_server.geocode_namedplace_point invoked with params (%, %, %, %, %)', user_id, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', city_name, country_name;
|
||||
RAISE NOTICE 'cdb_geocoder_server.cdb_geocode_namedplace_point invoked with params (%, %, %, %, %)', user_id, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', city_name, country_name;
|
||||
RETURN NULL;
|
||||
END;
|
||||
$$ LANGUAGE 'plpgsql';
|
||||
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server.geocode_namedplace_point(user_id name, user_config JSON, geocoder_config JSON, city_name text, admin1_name text, country_name text)
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_namedplace_point(user_id name, user_config JSON, geocoder_config JSON, city_name text, admin1_name text, country_name text)
|
||||
RETURNS Geometry AS $$
|
||||
BEGIN
|
||||
RAISE NOTICE 'cdb_geocoder_server.geocode_namedplace_point invoked with params (%, %, %, %, %, %)', user_id, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', city_name, admin1_name, country_name;
|
||||
RAISE NOTICE 'cdb_geocoder_server.cdb_geocode_namedplace_point invoked with params (%, %, %, %, %, %)', user_id, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', city_name, admin1_name, country_name;
|
||||
RETURN NULL;
|
||||
END;
|
||||
$$ LANGUAGE 'plpgsql';
|
||||
|
||||
-- Exercise the public and the proxied function
|
||||
SELECT cdb_geocoder_client.geocode_namedplace_point('Elx');
|
||||
SELECT cdb_geocoder_client.geocode_namedplace_point('Elx', 'Spain');
|
||||
SELECT cdb_geocoder_client.geocode_namedplace_point('Elx', 'Valencia', 'Spain');
|
||||
SELECT cdb_geocode_namedplace_point('Elx');
|
||||
SELECT cdb_geocode_namedplace_point('Elx', 'Spain');
|
||||
SELECT cdb_geocode_namedplace_point('Elx', 'Valencia', 'Spain');
|
||||
|
||||
|
@ -1,20 +1,23 @@
|
||||
-- Add to the search path the schema
|
||||
SET search_path TO "$user",public,cartodb,cdb_geocoder_client;
|
||||
|
||||
-- Mock the server functions
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server.geocode_postalcode_polygon(user_id name, user_config JSON, geocoder_config JSON, postal_code text, country_name text)
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_postalcode_polygon(user_id name, user_config JSON, geocoder_config JSON, postal_code text, country_name text)
|
||||
RETURNS Geometry AS $$
|
||||
BEGIN
|
||||
RAISE NOTICE 'cdb_geocoder_server.geocode_postalcode_polygon invoked with params (%, %, %, %, %)', user_id, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', postal_code, country_name;
|
||||
RAISE NOTICE 'cdb_geocoder_server.cdb_geocode_postalcode_polygon invoked with params (%, %, %, %, %)', user_id, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', postal_code, country_name;
|
||||
RETURN NULL;
|
||||
END;
|
||||
$$ LANGUAGE 'plpgsql';
|
||||
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server.geocode_postalcode_point(user_id name, user_config JSON, geocoder_config JSON, postal_code text, country_name text)
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_postalcode_point(user_id name, user_config JSON, geocoder_config JSON, postal_code text, country_name text)
|
||||
RETURNS Geometry AS $$
|
||||
BEGIN
|
||||
RAISE NOTICE 'cdb_geocoder_server.geocode_postalcode_point invoked with params (%, %, %, %, %)', user_id, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', postal_code, country_name;
|
||||
RAISE NOTICE 'cdb_geocoder_server.cdb_geocode_postalcode_point invoked with params (%, %, %, %, %)', user_id, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', postal_code, country_name;
|
||||
RETURN NULL;
|
||||
END;
|
||||
$$ LANGUAGE 'plpgsql';
|
||||
|
||||
-- Exercise the public and the proxied function
|
||||
SELECT cdb_geocoder_client.geocode_postalcode_polygon('03204', 'Spain');
|
||||
SELECT cdb_geocoder_client.geocode_postalcode_point('03204', 'Spain');
|
||||
SELECT cdb_geocode_postalcode_polygon('03204', 'Spain');
|
||||
SELECT cdb_geocode_postalcode_point('03204', 'Spain');
|
||||
|
@ -1,12 +1,15 @@
|
||||
-- Add to the search path the schema
|
||||
SET search_path TO "$user",public,cartodb,cdb_geocoder_client;
|
||||
|
||||
-- Mock the server functions
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server.geocode_ipaddress_point(user_id name, user_config JSON, geocoder_config JSON, ip_address text)
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_ipaddress_point(user_id name, user_config JSON, geocoder_config JSON, ip_address text)
|
||||
RETURNS Geometry AS $$
|
||||
BEGIN
|
||||
RAISE NOTICE 'cdb_geocoder_server.geocode_ipaddress_point invoked with params (%, %, %, %)', user_id, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', ip_address;
|
||||
RAISE NOTICE 'cdb_geocoder_server.cdb_geocode_ipaddress_point invoked with params (%, %, %, %)', user_id, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', ip_address;
|
||||
RETURN NULL;
|
||||
END;
|
||||
$$ LANGUAGE 'plpgsql';
|
||||
|
||||
|
||||
-- Exercise the public and the proxied function
|
||||
SELECT cdb_geocoder_client.geocode_ipaddress_point('8.8.8.8');
|
||||
SELECT cdb_geocode_ipaddress_point('8.8.8.8');
|
||||
|
@ -1,25 +1,28 @@
|
||||
-- Use regular user role
|
||||
SET ROLE test_regular_user;
|
||||
|
||||
-- Add to the search path the schema
|
||||
SET search_path TO "$user",public,cartodb,cdb_geocoder_client;
|
||||
|
||||
-- Exercise the public function
|
||||
-- it is public, it shall work
|
||||
SELECT cdb_geocoder_client.geocode_admin0_polygon('Spain');
|
||||
SELECT cdb_geocoder_client.geocode_admin1_polygon('California');
|
||||
SELECT cdb_geocoder_client.geocode_admin1_polygon('California', 'United States');
|
||||
SELECT cdb_geocoder_client.geocode_namedplace_point('Elx');
|
||||
SELECT cdb_geocoder_client.geocode_namedplace_point('Elx', 'Valencia');
|
||||
SELECT cdb_geocoder_client.geocode_namedplace_point('Elx', 'Valencia', 'Spain');
|
||||
SELECT cdb_geocoder_client.geocode_postalcode_polygon('03204', 'Spain');
|
||||
SELECT cdb_geocoder_client.geocode_postalcode_point('03204', 'Spain');
|
||||
SELECT cdb_geocoder_client.geocode_ipaddress_point('8.8.8.8');
|
||||
SELECT cdb_geocode_admin0_polygon('Spain');
|
||||
SELECT cdb_geocode_admin1_polygon('California');
|
||||
SELECT cdb_geocode_admin1_polygon('California', 'United States');
|
||||
SELECT cdb_geocode_namedplace_point('Elx');
|
||||
SELECT cdb_geocode_namedplace_point('Elx', 'Valencia');
|
||||
SELECT cdb_geocode_namedplace_point('Elx', 'Valencia', 'Spain');
|
||||
SELECT cdb_geocode_postalcode_polygon('03204', 'Spain');
|
||||
SELECT cdb_geocode_postalcode_point('03204', 'Spain');
|
||||
SELECT cdb_geocode_ipaddress_point('8.8.8.8');
|
||||
|
||||
-- Check the regular user has no permissions on private functions
|
||||
SELECT cdb_geocoder_client._geocode_admin0_polygon('evil_user', '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Hell');
|
||||
SELECT cdb_geocoder_client._geocode_admin1_polygon('evil_user', '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Hell');
|
||||
SELECT cdb_geocoder_client._geocode_admin1_polygon('evil_user', '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Sheol', 'Hell');
|
||||
SELECT cdb_geocoder_client._geocode_namedplace_point('evil_user', '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Sheol');
|
||||
SELECT cdb_geocoder_client._geocode_namedplace_point('evil_user', '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Sheol', 'Hell');
|
||||
SELECT cdb_geocoder_client._geocode_namedplace_point('evil_user', '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Sheol', 'Hell', 'Ugly world');
|
||||
SELECT cdb_geocoder_client._geocode_postalcode_polygon('evil_user', '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', '66666', 'Hell');
|
||||
SELECT cdb_geocoder_client._geocode_postalcode_point('evil_user', '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', '66666', 'Hell');
|
||||
SELECT cdb_geocoder_client._geocode_ipaddress_point('evil_user', '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', '8.8.8.8');
|
||||
SELECT _cdb_geocode_admin0_polygon('evil_user', '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Hell');
|
||||
SELECT _cdb_geocode_admin1_polygon('evil_user', '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Hell');
|
||||
SELECT _cdb_geocode_admin1_polygon('evil_user', '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Sheol', 'Hell');
|
||||
SELECT _cdb_geocode_namedplace_point('evil_user', '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Sheol');
|
||||
SELECT _cdb_geocode_namedplace_point('evil_user', '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Sheol', 'Hell');
|
||||
SELECT _cdb_geocode_namedplace_point('evil_user', '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Sheol', 'Hell', 'Ugly world');
|
||||
SELECT _cdb_geocode_postalcode_polygon('evil_user', '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', '66666', 'Hell');
|
||||
SELECT _cdb_geocode_postalcode_point('evil_user', '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', '66666', 'Hell');
|
||||
SELECT _cdb_geocode_ipaddress_point('evil_user', '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', '8.8.8.8');
|
||||
|
@ -1,19 +1,19 @@
|
||||
---
|
||||
- name: geocode_admin0_polygon
|
||||
- name: cdb_geocode_admin0_polygon
|
||||
return_type: Geometry
|
||||
user_config_key: user_config
|
||||
geocoder_config_key: geocoder_config
|
||||
params:
|
||||
- { name: country_name, type: text }
|
||||
|
||||
- name: geocode_admin1_polygon
|
||||
- name: cdb_geocode_admin1_polygon
|
||||
return_type: Geometry
|
||||
user_config_key: user_config
|
||||
geocoder_config_key: geocoder_config
|
||||
params:
|
||||
- { name: admin1_name, type: text }
|
||||
|
||||
- name: geocode_admin1_polygon
|
||||
- name: cdb_geocode_admin1_polygon
|
||||
return_type: Geometry
|
||||
user_config_key: user_config
|
||||
geocoder_config_key: geocoder_config
|
||||
@ -21,14 +21,14 @@
|
||||
- { name: admin1_name, type: text }
|
||||
- { name: country_name, type: text }
|
||||
|
||||
- name: geocode_namedplace_point
|
||||
- name: cdb_geocode_namedplace_point
|
||||
return_type: Geometry
|
||||
user_config_key: user_config
|
||||
geocoder_config_key: geocoder_config
|
||||
params:
|
||||
- { name: city_name, type: text}
|
||||
|
||||
- name: geocode_namedplace_point
|
||||
- name: cdb_geocode_namedplace_point
|
||||
return_type: Geometry
|
||||
user_config_key: user_config
|
||||
geocoder_config_key: geocoder_config
|
||||
@ -36,7 +36,7 @@
|
||||
- { name: city_name, type: text}
|
||||
- { name: country_name, type: text}
|
||||
|
||||
- name: geocode_namedplace_point
|
||||
- name: cdb_geocode_namedplace_point
|
||||
return_type: Geometry
|
||||
user_config_key: user_config
|
||||
geocoder_config_key: geocoder_config
|
||||
@ -46,7 +46,7 @@
|
||||
- { name: country_name, type: text}
|
||||
|
||||
|
||||
- name: geocode_postalcode_polygon
|
||||
- name: cdb_geocode_postalcode_polygon
|
||||
return_type: Geometry
|
||||
user_config_key: user_config
|
||||
geocoder_config_key: geocoder_config
|
||||
@ -54,7 +54,7 @@
|
||||
- { name: postal_code, type: text}
|
||||
- { name: country_name, type: text}
|
||||
|
||||
- name: geocode_postalcode_point
|
||||
- name: cdb_geocode_postalcode_point
|
||||
return_type: Geometry
|
||||
user_config_key: user_config
|
||||
geocoder_config_key: geocoder_config
|
||||
@ -62,7 +62,7 @@
|
||||
- { name: postal_code, type: text}
|
||||
- { name: country_name, type: text}
|
||||
|
||||
- name: geocode_ipaddress_point
|
||||
- name: cdb_geocode_ipaddress_point
|
||||
return_type: Geometry
|
||||
user_config_key: user_config
|
||||
geocoder_config_key: geocoder_config
|
||||
|
@ -1,8 +1,8 @@
|
||||
-- Check that the public function is callable, even with no data
|
||||
-- It should return NULL
|
||||
SELECT cdb_geocoder_server.geocode_admin0_polygon(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 0, "nokia_soft_geocoder_limit": false}', 'Spain');
|
||||
geocode_admin0_polygon
|
||||
------------------------
|
||||
SELECT cdb_geocoder_server.cdb_geocode_admin0_polygon(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 0, "nokia_soft_geocoder_limit": false}', 'Spain');
|
||||
cdb_geocode_admin0_polygon
|
||||
----------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
@ -16,8 +16,8 @@ INSERT INTO ne_admin0_v3 (adm0_a3, the_geom) VALUES('ESP', ST_GeomFromText(
|
||||
-71.1031880899493 42.3152774590236))',4326)
|
||||
);
|
||||
-- This should return the polygon inserted above
|
||||
SELECT cdb_geocoder_server.geocode_admin0_polygon(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 0, "nokia_soft_geocoder_limit": false}', 'Spain');
|
||||
geocode_admin0_polygon
|
||||
SELECT cdb_geocoder_server.cdb_geocode_admin0_polygon(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 0, "nokia_soft_geocoder_limit": false}', 'Spain');
|
||||
cdb_geocode_admin0_polygon
|
||||
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
0103000020E61000000100000004000000D0EA37A29AC651C00FD603035B284540FEFCFB379AC651C0C0503E9F5B284540FFDDDD4D96C651C033AC3B284F284540D0EA37A29AC651C00FD603035B284540
|
||||
(1 row)
|
||||
@ -27,7 +27,7 @@ SELECT exists(SELECT *
|
||||
FROM pg_proc p
|
||||
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
||||
WHERE ns.nspname = 'cdb_geocoder_server'
|
||||
AND proname = 'geocode_admin0_polygon'
|
||||
AND proname = 'cdb_geocode_admin0_polygon'
|
||||
AND oidvectortypes(p.proargtypes) = 'name, json, json, text');
|
||||
exists
|
||||
--------
|
||||
@ -38,7 +38,7 @@ SELECT exists(SELECT *
|
||||
FROM pg_proc p
|
||||
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
||||
WHERE ns.nspname = 'cdb_geocoder_server'
|
||||
AND proname = '_geocode_admin0_polygon'
|
||||
AND proname = '_cdb_geocode_admin0_polygon'
|
||||
AND oidvectortypes(p.proargtypes) = 'text');
|
||||
exists
|
||||
--------
|
||||
|
@ -1,14 +1,14 @@
|
||||
-- Check that the public function is callable, even with no data
|
||||
-- It should return NULL
|
||||
SELECT cdb_geocoder_server.geocode_admin1_polygon(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'California');
|
||||
geocode_admin1_polygon
|
||||
------------------------
|
||||
SELECT cdb_geocoder_server.cdb_geocode_admin1_polygon(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'California');
|
||||
cdb_geocode_admin1_polygon
|
||||
----------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocoder_server.geocode_admin1_polygon(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'California', 'United States');
|
||||
geocode_admin1_polygon
|
||||
------------------------
|
||||
SELECT cdb_geocoder_server.cdb_geocode_admin1_polygon(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'California', 'United States');
|
||||
cdb_geocode_admin1_polygon
|
||||
----------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
@ -22,14 +22,14 @@ INSERT INTO global_province_polygons (synonyms, iso3, the_geom) VALUES (Array['c
|
||||
-71.1031880899493 42.3152774590236))',4326)
|
||||
);
|
||||
-- This should return the polygon inserted above
|
||||
SELECT cdb_geocoder_server.geocode_admin1_polygon(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 0, "nokia_soft_geocoder_limit": false}', 'California');
|
||||
geocode_admin1_polygon
|
||||
SELECT cdb_geocoder_server.cdb_geocode_admin1_polygon(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 0, "nokia_soft_geocoder_limit": false}', 'California');
|
||||
cdb_geocode_admin1_polygon
|
||||
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
0103000020E61000000100000004000000D0EA37A29AC651C00FD603035B284540FEFCFB379AC651C0C0503E9F5B284540FFDDDD4D96C651C033AC3B284F284540D0EA37A29AC651C00FD603035B284540
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocoder_server.geocode_admin1_polygon(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 0, "nokia_soft_geocoder_limit": false}', 'California', 'United States');
|
||||
geocode_admin1_polygon
|
||||
SELECT cdb_geocoder_server.cdb_geocode_admin1_polygon(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 0, "nokia_soft_geocoder_limit": false}', 'California', 'United States');
|
||||
cdb_geocode_admin1_polygon
|
||||
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
0103000020E61000000100000004000000D0EA37A29AC651C00FD603035B284540FEFCFB379AC651C0C0503E9F5B284540FFDDDD4D96C651C033AC3B284F284540D0EA37A29AC651C00FD603035B284540
|
||||
(1 row)
|
||||
@ -39,7 +39,7 @@ SELECT exists(SELECT *
|
||||
FROM pg_proc p
|
||||
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
||||
WHERE ns.nspname = 'cdb_geocoder_server'
|
||||
AND proname = 'geocode_admin1_polygon'
|
||||
AND proname = 'cdb_geocode_admin1_polygon'
|
||||
AND oidvectortypes(p.proargtypes) = 'name, json, json, text');
|
||||
exists
|
||||
--------
|
||||
@ -50,7 +50,7 @@ SELECT exists(SELECT *
|
||||
FROM pg_proc p
|
||||
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
||||
WHERE ns.nspname = 'cdb_geocoder_server'
|
||||
AND proname = 'geocode_admin1_polygon'
|
||||
AND proname = 'cdb_geocode_admin1_polygon'
|
||||
AND oidvectortypes(p.proargtypes) = 'name, json, json, text, text');
|
||||
exists
|
||||
--------
|
||||
@ -61,7 +61,7 @@ SELECT exists(SELECT *
|
||||
FROM pg_proc p
|
||||
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
||||
WHERE ns.nspname = 'cdb_geocoder_server'
|
||||
AND proname = '_geocode_admin1_polygon'
|
||||
AND proname = '_cdb_geocode_admin1_polygon'
|
||||
AND oidvectortypes(p.proargtypes) = 'text');
|
||||
exists
|
||||
--------
|
||||
@ -72,7 +72,7 @@ SELECT exists(SELECT *
|
||||
FROM pg_proc p
|
||||
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
||||
WHERE ns.nspname = 'cdb_geocoder_server'
|
||||
AND proname = '_geocode_admin1_polygon'
|
||||
AND proname = '_cdb_geocode_admin1_polygon'
|
||||
AND oidvectortypes(p.proargtypes) = 'text, text');
|
||||
exists
|
||||
--------
|
||||
|
@ -1,20 +1,20 @@
|
||||
-- Check that the public function is callable, even with no data
|
||||
-- It should return NULL
|
||||
SELECT cdb_geocoder_server.geocode_namedplace_point(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Elx');
|
||||
geocode_namedplace_point
|
||||
--------------------------
|
||||
SELECT cdb_geocoder_server.cdb_geocode_namedplace_point(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Elx');
|
||||
cdb_geocode_namedplace_point
|
||||
------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocoder_server.geocode_namedplace_point(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Elx', 'Spain');
|
||||
geocode_namedplace_point
|
||||
--------------------------
|
||||
SELECT cdb_geocoder_server.cdb_geocode_namedplace_point(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Elx', 'Spain');
|
||||
cdb_geocode_namedplace_point
|
||||
------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocoder_server.geocode_namedplace_point(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Elx', 'Valencia', 'Spain');
|
||||
geocode_namedplace_point
|
||||
--------------------------
|
||||
SELECT cdb_geocoder_server.cdb_geocode_namedplace_point(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Elx', 'Valencia', 'Spain');
|
||||
cdb_geocode_namedplace_point
|
||||
------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
@ -31,38 +31,38 @@ INSERT INTO country_decoder (synonyms, iso2) VALUES (Array['spain'], 'ES');
|
||||
-- Insert dummy data into admin1 decoder table
|
||||
INSERT INTO admin1_decoder (admin1, synonyms, iso2) VALUES ('Valencia', Array['valencia', 'Valencia'], 'ES');
|
||||
-- This should return the point inserted above
|
||||
SELECT cdb_geocoder_server.geocode_namedplace_point(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Elx');
|
||||
geocode_namedplace_point
|
||||
SELECT cdb_geocoder_server.cdb_geocode_namedplace_point(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Elx');
|
||||
cdb_geocode_namedplace_point
|
||||
----------------------------------------------------
|
||||
0101000020E6100000637FD93D7958E63F2ECA6C9049A24340
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocoder_server.geocode_namedplace_point(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Elche');
|
||||
geocode_namedplace_point
|
||||
SELECT cdb_geocoder_server.cdb_geocode_namedplace_point(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Elche');
|
||||
cdb_geocode_namedplace_point
|
||||
----------------------------------------------------
|
||||
0101000020E6100000637FD93D7958E63F2ECA6C9049A24340
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocoder_server.geocode_namedplace_point(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Elx', 'Spain');
|
||||
geocode_namedplace_point
|
||||
SELECT cdb_geocoder_server.cdb_geocode_namedplace_point(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Elx', 'Spain');
|
||||
cdb_geocode_namedplace_point
|
||||
----------------------------------------------------
|
||||
0101000020E6100000637FD93D7958E63F2ECA6C9049A24340
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocoder_server.geocode_namedplace_point(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Elche', 'Spain');
|
||||
geocode_namedplace_point
|
||||
SELECT cdb_geocoder_server.cdb_geocode_namedplace_point(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Elche', 'Spain');
|
||||
cdb_geocode_namedplace_point
|
||||
----------------------------------------------------
|
||||
0101000020E6100000637FD93D7958E63F2ECA6C9049A24340
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocoder_server.geocode_namedplace_point(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Elx', 'Valencia', 'Spain');
|
||||
geocode_namedplace_point
|
||||
SELECT cdb_geocoder_server.cdb_geocode_namedplace_point(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Elx', 'Valencia', 'Spain');
|
||||
cdb_geocode_namedplace_point
|
||||
----------------------------------------------------
|
||||
0101000020E6100000637FD93D7958E63F2ECA6C9049A24340
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocoder_server.geocode_namedplace_point(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Elche', 'valencia', 'Spain');
|
||||
geocode_namedplace_point
|
||||
SELECT cdb_geocoder_server.cdb_geocode_namedplace_point(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Elche', 'valencia', 'Spain');
|
||||
cdb_geocode_namedplace_point
|
||||
----------------------------------------------------
|
||||
0101000020E6100000637FD93D7958E63F2ECA6C9049A24340
|
||||
(1 row)
|
||||
@ -72,7 +72,7 @@ SELECT exists(SELECT *
|
||||
FROM pg_proc p
|
||||
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
||||
WHERE ns.nspname = 'cdb_geocoder_server'
|
||||
AND proname = 'geocode_namedplace_point'
|
||||
AND proname = 'cdb_geocode_namedplace_point'
|
||||
AND oidvectortypes(p.proargtypes) = 'name, json, json, text');
|
||||
exists
|
||||
--------
|
||||
@ -83,7 +83,7 @@ SELECT exists(SELECT *
|
||||
FROM pg_proc p
|
||||
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
||||
WHERE ns.nspname = 'cdb_geocoder_server'
|
||||
AND proname = 'geocode_namedplace_point'
|
||||
AND proname = 'cdb_geocode_namedplace_point'
|
||||
AND oidvectortypes(p.proargtypes) = 'name, json, json, text, text');
|
||||
exists
|
||||
--------
|
||||
@ -94,7 +94,7 @@ SELECT exists(SELECT *
|
||||
FROM pg_proc p
|
||||
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
||||
WHERE ns.nspname = 'cdb_geocoder_server'
|
||||
AND proname = 'geocode_namedplace_point'
|
||||
AND proname = 'cdb_geocode_namedplace_point'
|
||||
AND oidvectortypes(p.proargtypes) = 'name, json, json, text, text');
|
||||
exists
|
||||
--------
|
||||
@ -105,7 +105,7 @@ SELECT exists(SELECT *
|
||||
FROM pg_proc p
|
||||
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
||||
WHERE ns.nspname = 'cdb_geocoder_server'
|
||||
AND proname = '_geocode_namedplace_point'
|
||||
AND proname = '_cdb_geocode_namedplace_point'
|
||||
AND oidvectortypes(p.proargtypes) = 'text');
|
||||
exists
|
||||
--------
|
||||
@ -116,7 +116,7 @@ SELECT exists(SELECT *
|
||||
FROM pg_proc p
|
||||
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
||||
WHERE ns.nspname = 'cdb_geocoder_server'
|
||||
AND proname = '_geocode_namedplace_point'
|
||||
AND proname = '_cdb_geocode_namedplace_point'
|
||||
AND oidvectortypes(p.proargtypes) = 'text, text');
|
||||
exists
|
||||
--------
|
||||
@ -127,7 +127,7 @@ SELECT exists(SELECT *
|
||||
FROM pg_proc p
|
||||
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
||||
WHERE ns.nspname = 'cdb_geocoder_server'
|
||||
AND proname = '_geocode_namedplace_point'
|
||||
AND proname = '_cdb_geocode_namedplace_point'
|
||||
AND oidvectortypes(p.proargtypes) = 'text, text, text');
|
||||
exists
|
||||
--------
|
||||
|
@ -6,9 +6,9 @@ DELETE FROM available_services;
|
||||
DELETE FROM admin0_synonyms;
|
||||
-- Check that the public function is callable, even with no data
|
||||
-- It should return NULL
|
||||
SELECT cdb_geocoder_server.geocode_postalcode_point(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', '03204');
|
||||
geocode_postalcode_point
|
||||
--------------------------
|
||||
SELECT cdb_geocoder_server.cdb_geocode_postalcode_point(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', '03204');
|
||||
cdb_geocode_postalcode_point
|
||||
------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
@ -42,26 +42,26 @@ INSERT INTO admin0_synonyms (adm0_a3, name, name_, rank) VALUES (
|
||||
3
|
||||
);
|
||||
-- This should return the polygon inserted above
|
||||
SELECT cdb_geocoder_server.geocode_postalcode_point(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', '03204');
|
||||
geocode_postalcode_point
|
||||
SELECT cdb_geocoder_server.cdb_geocode_postalcode_point(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', '03204');
|
||||
cdb_geocode_postalcode_point
|
||||
----------------------------------------------------
|
||||
0101000020E61000000000000000E040408036B47414764840
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocoder_server.geocode_postalcode_point(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', '03204', 'spain');
|
||||
geocode_postalcode_point
|
||||
SELECT cdb_geocoder_server.cdb_geocode_postalcode_point(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', '03204', 'spain');
|
||||
cdb_geocode_postalcode_point
|
||||
----------------------------------------------------
|
||||
0101000020E61000000000000000E040408036B47414764840
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocoder_server.geocode_postalcode_polygon(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', '03204');
|
||||
geocode_postalcode_polygon
|
||||
SELECT cdb_geocoder_server.cdb_geocode_postalcode_polygon(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', '03204');
|
||||
cdb_geocode_postalcode_polygon
|
||||
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
0106000020E610000001000000010300000001000000040000000000000000E000C01F383D7839B740400000000000E000C0AA3C0EDE220F3B4000000000004812404FB7FCCD04893D400000000000E000C01F383D7839B74040
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocoder_server.geocode_postalcode_polygon(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', '03204', 'spain');
|
||||
geocode_postalcode_polygon
|
||||
SELECT cdb_geocoder_server.cdb_geocode_postalcode_polygon(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', '03204', 'spain');
|
||||
cdb_geocode_postalcode_polygon
|
||||
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
0106000020E610000001000000010300000001000000040000000000000000E000C01F383D7839B740400000000000E000C0AA3C0EDE220F3B4000000000004812404FB7FCCD04893D400000000000E000C01F383D7839B74040
|
||||
(1 row)
|
||||
@ -77,7 +77,7 @@ SELECT exists(SELECT *
|
||||
FROM pg_proc p
|
||||
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
||||
WHERE ns.nspname = 'cdb_geocoder_server'
|
||||
AND proname = 'geocode_postalcode_point'
|
||||
AND proname = 'cdb_geocode_postalcode_point'
|
||||
AND oidvectortypes(p.proargtypes) = 'name, json, json, text');
|
||||
exists
|
||||
--------
|
||||
@ -88,7 +88,7 @@ SELECT exists(SELECT *
|
||||
FROM pg_proc p
|
||||
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
||||
WHERE ns.nspname = 'cdb_geocoder_server'
|
||||
AND proname = 'geocode_postalcode_point'
|
||||
AND proname = 'cdb_geocode_postalcode_point'
|
||||
AND oidvectortypes(p.proargtypes) = 'name, json, json, text, text');
|
||||
exists
|
||||
--------
|
||||
@ -99,7 +99,7 @@ SELECT exists(SELECT *
|
||||
FROM pg_proc p
|
||||
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
||||
WHERE ns.nspname = 'cdb_geocoder_server'
|
||||
AND proname = 'geocode_postalcode_polygon'
|
||||
AND proname = 'cdb_geocode_postalcode_polygon'
|
||||
AND oidvectortypes(p.proargtypes) = 'name, json, json, text');
|
||||
exists
|
||||
--------
|
||||
@ -110,7 +110,7 @@ SELECT exists(SELECT *
|
||||
FROM pg_proc p
|
||||
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
||||
WHERE ns.nspname = 'cdb_geocoder_server'
|
||||
AND proname = 'geocode_postalcode_polygon'
|
||||
AND proname = 'cdb_geocode_postalcode_polygon'
|
||||
AND oidvectortypes(p.proargtypes) = 'name, json, json, text, text');
|
||||
exists
|
||||
--------
|
||||
@ -121,7 +121,7 @@ SELECT exists(SELECT *
|
||||
FROM pg_proc p
|
||||
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
||||
WHERE ns.nspname = 'cdb_geocoder_server'
|
||||
AND proname = '_geocode_postalcode_point'
|
||||
AND proname = '_cdb_geocode_postalcode_point'
|
||||
AND oidvectortypes(p.proargtypes) = 'text');
|
||||
exists
|
||||
--------
|
||||
@ -132,7 +132,7 @@ SELECT exists(SELECT *
|
||||
FROM pg_proc p
|
||||
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
||||
WHERE ns.nspname = 'cdb_geocoder_server'
|
||||
AND proname = '_geocode_postalcode_point'
|
||||
AND proname = '_cdb_geocode_postalcode_point'
|
||||
AND oidvectortypes(p.proargtypes) = 'text, text');
|
||||
exists
|
||||
--------
|
||||
@ -143,7 +143,7 @@ SELECT exists(SELECT *
|
||||
FROM pg_proc p
|
||||
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
||||
WHERE ns.nspname = 'cdb_geocoder_server'
|
||||
AND proname = '_geocode_postalcode_polygon'
|
||||
AND proname = '_cdb_geocode_postalcode_polygon'
|
||||
AND oidvectortypes(p.proargtypes) = 'text');
|
||||
exists
|
||||
--------
|
||||
@ -154,7 +154,7 @@ SELECT exists(SELECT *
|
||||
FROM pg_proc p
|
||||
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
||||
WHERE ns.nspname = 'cdb_geocoder_server'
|
||||
AND proname = '_geocode_postalcode_polygon'
|
||||
AND proname = '_cdb_geocode_postalcode_polygon'
|
||||
AND oidvectortypes(p.proargtypes) = 'text, text');
|
||||
exists
|
||||
--------
|
||||
|
@ -1,16 +1,16 @@
|
||||
-- Check that the public function is callable, even with no data
|
||||
-- It should return NULL
|
||||
SELECT cdb_geocoder_server.geocode_ipaddress_point(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', '0.0.0.0');
|
||||
geocode_ipaddress_point
|
||||
-------------------------
|
||||
SELECT cdb_geocoder_server.cdb_geocode_ipaddress_point(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', '0.0.0.0');
|
||||
cdb_geocode_ipaddress_point
|
||||
-----------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
-- Insert dummy data into ip_address_locations
|
||||
INSERT INTO ip_address_locations VALUES ('::ffff:0.0.0.0'::inet, (ST_SetSRID(ST_MakePoint('40.40', '3.71'), 4326)));
|
||||
-- This should return the polygon inserted above
|
||||
SELECT cdb_geocoder_server.geocode_ipaddress_point(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', '0.0.0.0');
|
||||
geocode_ipaddress_point
|
||||
SELECT cdb_geocoder_server.cdb_geocode_ipaddress_point(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', '0.0.0.0');
|
||||
cdb_geocode_ipaddress_point
|
||||
----------------------------------------------------
|
||||
0101000020E61000003333333333334440AE47E17A14AE0D40
|
||||
(1 row)
|
||||
@ -20,7 +20,7 @@ SELECT exists(SELECT *
|
||||
FROM pg_proc p
|
||||
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
||||
WHERE ns.nspname = 'cdb_geocoder_server'
|
||||
AND proname = 'geocode_ipaddress_point'
|
||||
AND proname = 'cdb_geocode_ipaddress_point'
|
||||
AND oidvectortypes(p.proargtypes) = 'name, json, json, text');
|
||||
exists
|
||||
--------
|
||||
@ -31,7 +31,7 @@ SELECT exists(SELECT *
|
||||
FROM pg_proc p
|
||||
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
||||
WHERE ns.nspname = 'cdb_geocoder_server'
|
||||
AND proname = '_geocode_ipaddress_point'
|
||||
AND proname = '_cdb_geocode_ipaddress_point'
|
||||
AND oidvectortypes(p.proargtypes) = 'text');
|
||||
exists
|
||||
--------
|
||||
|
@ -1,5 +1,5 @@
|
||||
-- Geocodes a street address given a searchtext and a state and/or country
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server.geocode_street_point(searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL)
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_street_point(searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL)
|
||||
RETURNS Geometry
|
||||
AS $$
|
||||
import json
|
||||
|
@ -1,18 +1,18 @@
|
||||
-- Interface of the server extension
|
||||
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server.geocode_admin0_polygon(user_id name, user_config_data JSON, geocoder_config_data JSON, country_name text)
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_admin0_polygon(user_id name, user_config_data JSON, geocoder_config_data JSON, country_name text)
|
||||
RETURNS Geometry AS $$
|
||||
plpy.debug('Entering geocode_admin0_polygons')
|
||||
plpy.debug('Entering cdb_geocode_admin0_polygons')
|
||||
plpy.debug('user_id = %s' % user_id)
|
||||
|
||||
#--TODO: rate limiting check
|
||||
#--TODO: quota check
|
||||
|
||||
#-- Copied from the doc, see http://www.postgresql.org/docs/9.4/static/plpython-database.html
|
||||
plan = plpy.prepare("SELECT cdb_geocoder_server._geocode_admin0_polygon($1) AS mypolygon", ["text"])
|
||||
plan = plpy.prepare("SELECT cdb_geocoder_server._cdb_geocode_admin0_polygon($1) AS mypolygon", ["text"])
|
||||
rv = plpy.execute(plan, [country_name], 1)
|
||||
|
||||
plpy.debug('Returning from Returning from geocode_admin0_polygons')
|
||||
plpy.debug('Returning from Returning from cdb_geocode_admin0_polygons')
|
||||
return rv[0]["mypolygon"]
|
||||
$$ LANGUAGE plpythonu;
|
||||
|
||||
@ -21,7 +21,7 @@ $$ LANGUAGE plpythonu;
|
||||
|
||||
-- Implementation of the server extension
|
||||
-- Note: these functions depend on the cdb_geocoder extension
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server._geocode_admin0_polygon(country_name text)
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server._cdb_geocode_admin0_polygon(country_name text)
|
||||
RETURNS Geometry AS $$
|
||||
DECLARE
|
||||
ret Geometry;
|
||||
|
@ -1,36 +1,36 @@
|
||||
-- Interfacess of the server extension
|
||||
|
||||
---- geocode_admin1_polygon(admin1_name text)
|
||||
CREATE OR REPLACE FUNCTION geocode_admin1_polygon(user_id name, user_config json, geocoder_config json, admin1_name text)
|
||||
---- cdb_geocode_admin1_polygon(admin1_name text)
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_admin1_polygon(user_id name, user_config json, geocoder_config json, admin1_name text)
|
||||
RETURNS Geometry AS $$
|
||||
plpy.debug('Entering geocode_admin1_polygon(admin1_name text)')
|
||||
plpy.debug('Entering cdb_geocode_admin1_polygon(admin1_name text)')
|
||||
plpy.debug('user_id = %s' % user_id)
|
||||
|
||||
#--TODO: rate limiting check
|
||||
#--TODO: quota check
|
||||
|
||||
#-- Copied from the doc, see http://www.postgresql.org/docs/9.4/static/plpython-database.html
|
||||
plan = plpy.prepare("SELECT cdb_geocoder_server._geocode_admin1_polygon($1) AS mypolygon", ["text"])
|
||||
plan = plpy.prepare("SELECT cdb_geocoder_server._cdb_geocode_admin1_polygon($1) AS mypolygon", ["text"])
|
||||
rv = plpy.execute(plan, [admin1_name], 1)
|
||||
|
||||
plpy.debug('Returning from Returning from geocode_admin1_polygons')
|
||||
plpy.debug('Returning from Returning from cdb_geocode_admin1_polygons')
|
||||
return rv[0]["mypolygon"]
|
||||
$$ LANGUAGE plpythonu;
|
||||
|
||||
---- geocode_admin1_polygon(admin1_name text, country_name text)
|
||||
CREATE OR REPLACE FUNCTION geocode_admin1_polygon(user_id name, user_config json, geocoder_config json, admin1_name text, country_name text)
|
||||
---- cdb_geocode_admin1_polygon(admin1_name text, country_name text)
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_admin1_polygon(user_id name, user_config json, geocoder_config json, admin1_name text, country_name text)
|
||||
RETURNS Geometry AS $$
|
||||
plpy.debug('Entering geocode_admin1_polygon(admin1_name text, country_name text)')
|
||||
plpy.debug('Entering cdb_geocode_admin1_polygon(admin1_name text, country_name text)')
|
||||
plpy.debug('user_id = %s' % user_id)
|
||||
|
||||
#--TODO: rate limiting check
|
||||
#--TODO: quota check
|
||||
|
||||
#-- Copied from the doc, see http://www.postgresql.org/docs/9.4/static/plpython-database.html
|
||||
plan = plpy.prepare("SELECT cdb_geocoder_server._geocode_admin1_polygon($1, $2) AS mypolygon", ["text", "text"])
|
||||
plan = plpy.prepare("SELECT cdb_geocoder_server._cdb_geocode_admin1_polygon($1, $2) AS mypolygon", ["text", "text"])
|
||||
rv = plpy.execute(plan, [admin1_name, country_name], 1)
|
||||
|
||||
plpy.debug('Returning from Returning from geocode_admin1_polygon(admin1_name text, country_name text)')
|
||||
plpy.debug('Returning from Returning from cdb_geocode_admin1_polygon(admin1_name text, country_name text)')
|
||||
return rv[0]["mypolygon"]
|
||||
$$ LANGUAGE plpythonu;
|
||||
|
||||
@ -39,8 +39,8 @@ $$ LANGUAGE plpythonu;
|
||||
-- Implementation of the server extension
|
||||
-- Note: these functions depend on the cdb_geocoder extension
|
||||
|
||||
---- geocode_admin1_polygon(admin1_name text)
|
||||
CREATE OR REPLACE FUNCTION _geocode_admin1_polygon(admin1_name text)
|
||||
---- cdb_geocode_admin1_polygon(admin1_name text)
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server._cdb_geocode_admin1_polygon(admin1_name text)
|
||||
RETURNS Geometry AS $$
|
||||
DECLARE
|
||||
ret Geometry;
|
||||
@ -63,8 +63,8 @@ RETURNS Geometry AS $$
|
||||
END
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
---- geocode_admin1_polygon(admin1_name text, country_name text)
|
||||
CREATE OR REPLACE FUNCTION _geocode_admin1_polygon(admin1_name text, country_name text)
|
||||
---- cdb_geocode_admin1_polygon(admin1_name text, country_name text)
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server._cdb_geocode_admin1_polygon(admin1_name text, country_name text)
|
||||
RETURNS Geometry AS $$
|
||||
DECLARE
|
||||
ret Geometry;
|
||||
|
@ -1,50 +1,50 @@
|
||||
-- Interfacess of the server extension
|
||||
|
||||
---- geocode_namedplace_point(city_name text)
|
||||
CREATE OR REPLACE FUNCTION geocode_namedplace_point(user_id name, user_config json, geocoder_config json, city_name text)
|
||||
---- cdb_geocode_namedplace_point(city_name text)
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_namedplace_point(user_id name, user_config json, geocoder_config json, city_name text)
|
||||
RETURNS Geometry AS $$
|
||||
plpy.debug('Entering geocode_namedplace_point(city_name text)')
|
||||
plpy.debug('Entering cdb_geocode_namedplace_point(city_name text)')
|
||||
plpy.debug('user_id = %s' % user_id)
|
||||
|
||||
#--TODO: rate limiting check
|
||||
#--TODO: quota check
|
||||
|
||||
#-- Copied from the doc, see http://www.postgresql.org/docs/9.4/static/plpython-database.html
|
||||
plan = plpy.prepare("SELECT cdb_geocoder_server._geocode_namedplace_point($1) AS mypoint", ["text"])
|
||||
plan = plpy.prepare("SELECT cdb_geocoder_server._cdb_geocode_namedplace_point($1) AS mypoint", ["text"])
|
||||
rv = plpy.execute(plan, [city_name], 1)
|
||||
|
||||
plpy.debug('Returning from Returning from geocode_namedplace')
|
||||
return rv[0]["mypoint"]
|
||||
$$ LANGUAGE plpythonu;
|
||||
|
||||
---- geocode_namedplace_point(city_name text, country_name text)
|
||||
CREATE OR REPLACE FUNCTION geocode_namedplace_point(user_id name, user_config json, geocoder_config json, city_name text, country_name text)
|
||||
---- cdb_geocode_namedplace_point(city_name text, country_name text)
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_namedplace_point(user_id name, user_config json, geocoder_config json, city_name text, country_name text)
|
||||
RETURNS Geometry AS $$
|
||||
plpy.debug('Entering geocode_namedplace_point(city_name text, country_name text)')
|
||||
plpy.debug('Entering cdb_geocode_namedplace_point(city_name text, country_name text)')
|
||||
plpy.debug('user_id = %s' % user_id)
|
||||
|
||||
#--TODO: rate limiting check
|
||||
#--TODO: quota check
|
||||
|
||||
#-- Copied from the doc, see http://www.postgresql.org/docs/9.4/static/plpython-database.html
|
||||
plan = plpy.prepare("SELECT cdb_geocoder_server._geocode_namedplace_point($1, $2) AS mypoint", ["text", "text"])
|
||||
plan = plpy.prepare("SELECT cdb_geocoder_server._cdb_geocode_namedplace_point($1, $2) AS mypoint", ["text", "text"])
|
||||
rv = plpy.execute(plan, [city_name, country_name], 1)
|
||||
|
||||
plpy.debug('Returning from Returning from geocode_namedplace')
|
||||
return rv[0]["mypoint"]
|
||||
$$ LANGUAGE plpythonu;
|
||||
|
||||
---- geocode_namedplace_point(city_name text, admin1_name text, country_name text)
|
||||
CREATE OR REPLACE FUNCTION geocode_namedplace_point(user_id name, user_config json, geocoder_config json, city_name text, admin1_name text, country_name text)
|
||||
---- cdb_geocode_namedplace_point(city_name text, admin1_name text, country_name text)
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_namedplace_point(user_id name, user_config json, geocoder_config json, city_name text, admin1_name text, country_name text)
|
||||
RETURNS Geometry AS $$
|
||||
plpy.debug('Entering geocode_namedplace_point(city_name text, admin1_name text, country_name text)')
|
||||
plpy.debug('Entering cdb_geocode_namedplace_point(city_name text, admin1_name text, country_name text)')
|
||||
plpy.debug('user_id = %s' % user_id)
|
||||
|
||||
#--TODO: rate limiting check
|
||||
#--TODO: quota check
|
||||
|
||||
#-- Copied from the doc, see http://www.postgresql.org/docs/9.4/static/plpython-database.html
|
||||
plan = plpy.prepare("SELECT cdb_geocoder_server._geocode_namedplace_point($1, $2, $3) AS mypoint", ["text", "text", "text"])
|
||||
plan = plpy.prepare("SELECT cdb_geocoder_server._cdb_geocode_namedplace_point($1, $2, $3) AS mypoint", ["text", "text", "text"])
|
||||
rv = plpy.execute(plan, [city_name, admin1_name, country_name], 1)
|
||||
|
||||
plpy.debug('Returning from Returning from geocode_namedplace')
|
||||
@ -56,8 +56,8 @@ $$ LANGUAGE plpythonu;
|
||||
-- Implementation of the server extension
|
||||
-- Note: these functions depend on the cdb_geocoder extension
|
||||
|
||||
---- geocode_namedplace_point(city_name text)
|
||||
CREATE OR REPLACE FUNCTION _geocode_namedplace_point(city_name text)
|
||||
---- cdb_geocode_namedplace_point(city_name text)
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server._cdb_geocode_namedplace_point(city_name text)
|
||||
RETURNS Geometry AS $$
|
||||
DECLARE
|
||||
ret Geometry;
|
||||
@ -75,8 +75,8 @@ RETURNS Geometry AS $$
|
||||
END
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
---- geocode_namedplace_point(city_name text, country_name text)
|
||||
CREATE OR REPLACE FUNCTION _geocode_namedplace_point(city_name text, country_name text)
|
||||
---- cdb_geocode_namedplace_point(city_name text, country_name text)
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server._cdb_geocode_namedplace_point(city_name text, country_name text)
|
||||
RETURNS Geometry AS $$
|
||||
DECLARE
|
||||
ret Geometry;
|
||||
@ -95,8 +95,8 @@ RETURNS Geometry AS $$
|
||||
END
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
---- geocode_namedplace_point(city_name text, admin1_name text, country_name text)
|
||||
CREATE OR REPLACE FUNCTION _geocode_namedplace_point(city_name text, admin1_name text, country_name text)
|
||||
---- cdb_geocode_namedplace_point(city_name text, admin1_name text, country_name text)
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server._cdb_geocode_namedplace_point(city_name text, admin1_name text, country_name text)
|
||||
RETURNS Geometry AS $$
|
||||
DECLARE
|
||||
ret Geometry;
|
||||
|
@ -1,68 +1,66 @@
|
||||
-- TODO geocode_postalcode_polygon(code text, country text)
|
||||
|
||||
-- Interface of the server extension
|
||||
|
||||
CREATE OR REPLACE FUNCTION geocode_postalcode_point(user_id name, user_config json, geocoder_config json, code text)
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_postalcode_point(user_id name, user_config json, geocoder_config json, code text)
|
||||
RETURNS Geometry AS $$
|
||||
plpy.debug('Entering _geocode_postalcode_point')
|
||||
plpy.debug('Entering _cdb_geocode_postalcode_point')
|
||||
plpy.debug('user_id = %s' % user_id)
|
||||
|
||||
#--TODO: rate limiting check
|
||||
#--TODO: quota check
|
||||
|
||||
#-- Copied from the doc, see http://www.postgresql.org/docs/9.4/static/plpython-database.html
|
||||
plan = plpy.prepare("SELECT cdb_geocoder_server._geocode_postalcode_point($1) AS point", ["text"])
|
||||
plan = plpy.prepare("SELECT cdb_geocoder_server._cdb_geocode_postalcode_point($1) AS point", ["text"])
|
||||
rv = plpy.execute(plan, [code], 1)
|
||||
|
||||
plpy.debug('Returning from _geocode_postalcode_point')
|
||||
plpy.debug('Returning from _cdb_geocode_postalcode_point')
|
||||
return rv[0]["point"]
|
||||
$$ LANGUAGE plpythonu;
|
||||
|
||||
CREATE OR REPLACE FUNCTION geocode_postalcode_point(user_id name, user_config json, geocoder_config json, code text, country text)
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_postalcode_point(user_id name, user_config json, geocoder_config json, code text, country text)
|
||||
RETURNS Geometry AS $$
|
||||
plpy.debug('Entering _geocode_postalcode_point')
|
||||
plpy.debug('Entering _cdb_geocode_postalcode_point')
|
||||
plpy.debug('user_id = %s' % user_id)
|
||||
|
||||
#--TODO: rate limiting check
|
||||
#--TODO: quota check
|
||||
|
||||
#-- Copied from the doc, see http://www.postgresql.org/docs/9.4/static/plpython-database.html
|
||||
plan = plpy.prepare("SELECT cdb_geocoder_server._geocode_postalcode_point($1, $2) AS point", ["TEXT", "TEXT"])
|
||||
plan = plpy.prepare("SELECT cdb_geocoder_server._cdb_geocode_postalcode_point($1, $2) AS point", ["TEXT", "TEXT"])
|
||||
rv = plpy.execute(plan, [code, country], 1)
|
||||
|
||||
plpy.debug('Returning from _geocode_postalcode_point')
|
||||
plpy.debug('Returning from _cdb_geocode_postalcode_point')
|
||||
return rv[0]["point"]
|
||||
$$ LANGUAGE plpythonu;
|
||||
|
||||
CREATE OR REPLACE FUNCTION geocode_postalcode_polygon(user_id name, user_config json, geocoder_config json, code text)
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_postalcode_polygon(user_id name, user_config json, geocoder_config json, code text)
|
||||
RETURNS Geometry AS $$
|
||||
plpy.debug('Entering _geocode_postalcode_polygon')
|
||||
plpy.debug('Entering _cdb_geocode_postalcode_polygon')
|
||||
plpy.debug('user_id = %s' % user_id)
|
||||
|
||||
#--TODO: rate limiting check
|
||||
#--TODO: quota check
|
||||
|
||||
#-- Copied from the doc, see http://www.postgresql.org/docs/9.4/static/plpython-database.html
|
||||
plan = plpy.prepare("SELECT cdb_geocoder_server._geocode_postalcode_polygon($1) AS polygon", ["text"])
|
||||
plan = plpy.prepare("SELECT cdb_geocoder_server._cdb_geocode_postalcode_polygon($1) AS polygon", ["text"])
|
||||
rv = plpy.execute(plan, [code], 1)
|
||||
|
||||
plpy.debug('Returning from _geocode_postalcode_polygon')
|
||||
plpy.debug('Returning from _cdb_geocode_postalcode_polygon')
|
||||
return rv[0]["polygon"]
|
||||
$$ LANGUAGE plpythonu;
|
||||
|
||||
CREATE OR REPLACE FUNCTION geocode_postalcode_polygon(user_id name, user_config json, geocoder_config json, code text, country text)
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_postalcode_polygon(user_id name, user_config json, geocoder_config json, code text, country text)
|
||||
RETURNS Geometry AS $$
|
||||
plpy.debug('Entering _geocode_postalcode_point')
|
||||
plpy.debug('Entering _cdb_geocode_postalcode_point')
|
||||
plpy.debug('user_id = %s' % user_id)
|
||||
|
||||
#--TODO: rate limiting check
|
||||
#--TODO: quota check
|
||||
|
||||
#-- Copied from the doc, see http://www.postgresql.org/docs/9.4/static/plpython-database.html
|
||||
plan = plpy.prepare("SELECT cdb_geocoder_server._geocode_postalcode_polygon($1, $2) AS polygon", ["TEXT", "TEXT"])
|
||||
plan = plpy.prepare("SELECT cdb_geocoder_server._cdb_geocode_postalcode_polygon($1, $2) AS polygon", ["TEXT", "TEXT"])
|
||||
rv = plpy.execute(plan, [code, country], 1)
|
||||
|
||||
plpy.debug('Returning from _geocode_postalcode_point')
|
||||
plpy.debug('Returning from _cdb_geocode_postalcode_point')
|
||||
return rv[0]["polygon"]
|
||||
$$ LANGUAGE plpythonu;
|
||||
|
||||
@ -71,7 +69,7 @@ $$ LANGUAGE plpythonu;
|
||||
|
||||
-- Implementation of the server extension
|
||||
-- Note: these functions depend on the cdb_geocoder extension
|
||||
CREATE OR REPLACE FUNCTION _geocode_postalcode_point(code text)
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server._cdb_geocode_postalcode_point(code text)
|
||||
RETURNS Geometry AS $$
|
||||
DECLARE
|
||||
ret Geometry;
|
||||
@ -92,7 +90,7 @@ RETURNS Geometry AS $$
|
||||
END
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE OR REPLACE FUNCTION _geocode_postalcode_point(code text, country text)
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server._cdb_geocode_postalcode_point(code text, country text)
|
||||
RETURNS Geometry AS $$
|
||||
DECLARE
|
||||
ret Geometry;
|
||||
@ -117,7 +115,7 @@ RETURNS Geometry AS $$
|
||||
END
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE OR REPLACE FUNCTION _geocode_postalcode_polygon(code text)
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server._cdb_geocode_postalcode_polygon(code text)
|
||||
RETURNS Geometry AS $$
|
||||
DECLARE
|
||||
ret Geometry;
|
||||
@ -138,7 +136,7 @@ RETURNS Geometry AS $$
|
||||
END
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE OR REPLACE FUNCTION _geocode_postalcode_polygon(code text, country text)
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server._cdb_geocode_postalcode_polygon(code text, country text)
|
||||
RETURNS Geometry AS $$
|
||||
DECLARE
|
||||
ret Geometry;
|
||||
|
@ -1,18 +1,18 @@
|
||||
-- Interface of the server extension
|
||||
|
||||
CREATE OR REPLACE FUNCTION geocode_ipaddress_point(user_id name, user_config json, geocoder_config json, ip text)
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_ipaddress_point(user_id name, user_config json, geocoder_config json, ip text)
|
||||
RETURNS Geometry AS $$
|
||||
plpy.debug('Entering _geocode_ipaddress_point')
|
||||
plpy.debug('Entering _cdb_geocode_ipaddress_point')
|
||||
plpy.debug('user_id = %s' % user_id)
|
||||
|
||||
#--TODO: rate limiting check
|
||||
#--TODO: quota check
|
||||
|
||||
#-- Copied from the doc, see http://www.postgresql.org/docs/9.4/static/plpython-database.html
|
||||
plan = plpy.prepare("SELECT cdb_geocoder_server._geocode_ipaddress_point($1) AS point", ["TEXT"])
|
||||
plan = plpy.prepare("SELECT cdb_geocoder_server._cdb_geocode_ipaddress_point($1) AS point", ["TEXT"])
|
||||
rv = plpy.execute(plan, [ip], 1)
|
||||
|
||||
plpy.debug('Returning from _geocode_ipaddress_point')
|
||||
plpy.debug('Returning from _cdb_geocode_ipaddress_point')
|
||||
return rv[0]["point"]
|
||||
$$ LANGUAGE plpythonu;
|
||||
|
||||
@ -21,7 +21,7 @@ $$ LANGUAGE plpythonu;
|
||||
|
||||
-- Implementation of the server extension
|
||||
-- Note: these functions depend on the cdb_geocoder extension
|
||||
CREATE OR REPLACE FUNCTION _geocode_ipaddress_point(ip text)
|
||||
CREATE OR REPLACE FUNCTION cdb_geocoder_server._cdb_geocode_ipaddress_point(ip text)
|
||||
RETURNS Geometry AS $$
|
||||
DECLARE
|
||||
ret Geometry;
|
||||
|
@ -1,6 +1,6 @@
|
||||
-- Check that the public function is callable, even with no data
|
||||
-- It should return NULL
|
||||
SELECT cdb_geocoder_server.geocode_admin0_polygon(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 0, "nokia_soft_geocoder_limit": false}', 'Spain');
|
||||
SELECT cdb_geocoder_server.cdb_geocode_admin0_polygon(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 0, "nokia_soft_geocoder_limit": false}', 'Spain');
|
||||
|
||||
-- Insert some dummy synonym
|
||||
INSERT INTO admin0_synonyms (name, adm0_a3) VALUES ('Spain', 'ESP');
|
||||
@ -14,19 +14,19 @@ INSERT INTO ne_admin0_v3 (adm0_a3, the_geom) VALUES('ESP', ST_GeomFromText(
|
||||
);
|
||||
|
||||
-- This should return the polygon inserted above
|
||||
SELECT cdb_geocoder_server.geocode_admin0_polygon(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 0, "nokia_soft_geocoder_limit": false}', 'Spain');
|
||||
SELECT cdb_geocoder_server.cdb_geocode_admin0_polygon(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 0, "nokia_soft_geocoder_limit": false}', 'Spain');
|
||||
|
||||
-- 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'
|
||||
AND proname = 'geocode_admin0_polygon'
|
||||
AND proname = 'cdb_geocode_admin0_polygon'
|
||||
AND oidvectortypes(p.proargtypes) = 'name, json, json, text');
|
||||
|
||||
SELECT exists(SELECT *
|
||||
FROM pg_proc p
|
||||
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
||||
WHERE ns.nspname = 'cdb_geocoder_server'
|
||||
AND proname = '_geocode_admin0_polygon'
|
||||
AND proname = '_cdb_geocode_admin0_polygon'
|
||||
AND oidvectortypes(p.proargtypes) = 'text');
|
@ -1,7 +1,7 @@
|
||||
-- Check that the public function is callable, even with no data
|
||||
-- It should return NULL
|
||||
SELECT cdb_geocoder_server.geocode_admin1_polygon(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'California');
|
||||
SELECT cdb_geocoder_server.geocode_admin1_polygon(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'California', 'United States');
|
||||
SELECT cdb_geocoder_server.cdb_geocode_admin1_polygon(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'California');
|
||||
SELECT cdb_geocoder_server.cdb_geocode_admin1_polygon(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'California', 'United States');
|
||||
|
||||
-- Insert dummy data into country decoder table
|
||||
INSERT INTO country_decoder (synonyms, iso3) VALUES (Array['united states'], 'USA');
|
||||
@ -15,34 +15,34 @@ INSERT INTO global_province_polygons (synonyms, iso3, the_geom) VALUES (Array['c
|
||||
);
|
||||
|
||||
-- This should return the polygon inserted above
|
||||
SELECT cdb_geocoder_server.geocode_admin1_polygon(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 0, "nokia_soft_geocoder_limit": false}', 'California');
|
||||
SELECT cdb_geocoder_server.geocode_admin1_polygon(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 0, "nokia_soft_geocoder_limit": false}', 'California', 'United States');
|
||||
SELECT cdb_geocoder_server.cdb_geocode_admin1_polygon(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 0, "nokia_soft_geocoder_limit": false}', 'California');
|
||||
SELECT cdb_geocoder_server.cdb_geocode_admin1_polygon(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 0, "nokia_soft_geocoder_limit": false}', 'California', 'United States');
|
||||
|
||||
-- Check for admin1 signatures
|
||||
SELECT exists(SELECT *
|
||||
FROM pg_proc p
|
||||
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
||||
WHERE ns.nspname = 'cdb_geocoder_server'
|
||||
AND proname = 'geocode_admin1_polygon'
|
||||
AND proname = 'cdb_geocode_admin1_polygon'
|
||||
AND oidvectortypes(p.proargtypes) = 'name, json, json, text');
|
||||
|
||||
SELECT exists(SELECT *
|
||||
FROM pg_proc p
|
||||
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
||||
WHERE ns.nspname = 'cdb_geocoder_server'
|
||||
AND proname = 'geocode_admin1_polygon'
|
||||
AND proname = 'cdb_geocode_admin1_polygon'
|
||||
AND oidvectortypes(p.proargtypes) = 'name, json, json, text, text');
|
||||
|
||||
SELECT exists(SELECT *
|
||||
FROM pg_proc p
|
||||
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
||||
WHERE ns.nspname = 'cdb_geocoder_server'
|
||||
AND proname = '_geocode_admin1_polygon'
|
||||
AND proname = '_cdb_geocode_admin1_polygon'
|
||||
AND oidvectortypes(p.proargtypes) = 'text');
|
||||
|
||||
SELECT exists(SELECT *
|
||||
FROM pg_proc p
|
||||
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
||||
WHERE ns.nspname = 'cdb_geocoder_server'
|
||||
AND proname = '_geocode_admin1_polygon'
|
||||
AND proname = '_cdb_geocode_admin1_polygon'
|
||||
AND oidvectortypes(p.proargtypes) = 'text, text');
|
@ -1,8 +1,8 @@
|
||||
-- Check that the public function is callable, even with no data
|
||||
-- It should return NULL
|
||||
SELECT cdb_geocoder_server.geocode_namedplace_point(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Elx');
|
||||
SELECT cdb_geocoder_server.geocode_namedplace_point(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Elx', 'Spain');
|
||||
SELECT cdb_geocoder_server.geocode_namedplace_point(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Elx', 'Valencia', 'Spain');
|
||||
SELECT cdb_geocoder_server.cdb_geocode_namedplace_point(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Elx');
|
||||
SELECT cdb_geocoder_server.cdb_geocode_namedplace_point(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Elx', 'Spain');
|
||||
SELECT cdb_geocoder_server.cdb_geocode_namedplace_point(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Elx', 'Valencia', 'Spain');
|
||||
|
||||
-- Insert dummy data into points table
|
||||
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(
|
||||
@ -21,52 +21,52 @@ INSERT INTO country_decoder (synonyms, iso2) VALUES (Array['spain'], 'ES');
|
||||
INSERT INTO admin1_decoder (admin1, synonyms, iso2) VALUES ('Valencia', Array['valencia', 'Valencia'], 'ES');
|
||||
|
||||
-- This should return the point inserted above
|
||||
SELECT cdb_geocoder_server.geocode_namedplace_point(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Elx');
|
||||
SELECT cdb_geocoder_server.geocode_namedplace_point(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Elche');
|
||||
SELECT cdb_geocoder_server.geocode_namedplace_point(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Elx', 'Spain');
|
||||
SELECT cdb_geocoder_server.geocode_namedplace_point(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Elche', 'Spain');
|
||||
SELECT cdb_geocoder_server.geocode_namedplace_point(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Elx', 'Valencia', 'Spain');
|
||||
SELECT cdb_geocoder_server.geocode_namedplace_point(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Elche', 'valencia', 'Spain');
|
||||
SELECT cdb_geocoder_server.cdb_geocode_namedplace_point(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Elx');
|
||||
SELECT cdb_geocoder_server.cdb_geocode_namedplace_point(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Elche');
|
||||
SELECT cdb_geocoder_server.cdb_geocode_namedplace_point(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Elx', 'Spain');
|
||||
SELECT cdb_geocoder_server.cdb_geocode_namedplace_point(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Elche', 'Spain');
|
||||
SELECT cdb_geocoder_server.cdb_geocode_namedplace_point(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Elx', 'Valencia', 'Spain');
|
||||
SELECT cdb_geocoder_server.cdb_geocode_namedplace_point(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Elche', 'valencia', 'Spain');
|
||||
|
||||
-- Check for namedplaces signatures
|
||||
SELECT exists(SELECT *
|
||||
FROM pg_proc p
|
||||
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
||||
WHERE ns.nspname = 'cdb_geocoder_server'
|
||||
AND proname = 'geocode_namedplace_point'
|
||||
AND proname = 'cdb_geocode_namedplace_point'
|
||||
AND oidvectortypes(p.proargtypes) = 'name, json, json, text');
|
||||
|
||||
SELECT exists(SELECT *
|
||||
FROM pg_proc p
|
||||
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
||||
WHERE ns.nspname = 'cdb_geocoder_server'
|
||||
AND proname = 'geocode_namedplace_point'
|
||||
AND proname = 'cdb_geocode_namedplace_point'
|
||||
AND oidvectortypes(p.proargtypes) = 'name, json, json, text, text');
|
||||
|
||||
SELECT exists(SELECT *
|
||||
FROM pg_proc p
|
||||
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
||||
WHERE ns.nspname = 'cdb_geocoder_server'
|
||||
AND proname = 'geocode_namedplace_point'
|
||||
AND proname = 'cdb_geocode_namedplace_point'
|
||||
AND oidvectortypes(p.proargtypes) = 'name, json, json, text, text');
|
||||
|
||||
SELECT exists(SELECT *
|
||||
FROM pg_proc p
|
||||
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
||||
WHERE ns.nspname = 'cdb_geocoder_server'
|
||||
AND proname = '_geocode_namedplace_point'
|
||||
AND proname = '_cdb_geocode_namedplace_point'
|
||||
AND oidvectortypes(p.proargtypes) = 'text');
|
||||
|
||||
SELECT exists(SELECT *
|
||||
FROM pg_proc p
|
||||
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
||||
WHERE ns.nspname = 'cdb_geocoder_server'
|
||||
AND proname = '_geocode_namedplace_point'
|
||||
AND proname = '_cdb_geocode_namedplace_point'
|
||||
AND oidvectortypes(p.proargtypes) = 'text, text');
|
||||
|
||||
SELECT exists(SELECT *
|
||||
FROM pg_proc p
|
||||
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
||||
WHERE ns.nspname = 'cdb_geocoder_server'
|
||||
AND proname = '_geocode_namedplace_point'
|
||||
AND proname = '_cdb_geocode_namedplace_point'
|
||||
AND oidvectortypes(p.proargtypes) = 'text, text, text');
|
@ -7,7 +7,7 @@ DELETE FROM admin0_synonyms;
|
||||
|
||||
-- Check that the public function is callable, even with no data
|
||||
-- It should return NULL
|
||||
SELECT cdb_geocoder_server.geocode_postalcode_point(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', '03204');
|
||||
SELECT cdb_geocoder_server.cdb_geocode_postalcode_point(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', '03204');
|
||||
|
||||
-- Insert dummy data into ip_address_locations
|
||||
INSERT INTO global_postal_code_points (the_geom, iso3, postal_code, postal_code_num) VALUES (
|
||||
@ -44,13 +44,13 @@ INSERT INTO admin0_synonyms (adm0_a3, name, name_, rank) VALUES (
|
||||
);
|
||||
|
||||
-- This should return the polygon inserted above
|
||||
SELECT cdb_geocoder_server.geocode_postalcode_point(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', '03204');
|
||||
SELECT cdb_geocoder_server.cdb_geocode_postalcode_point(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', '03204');
|
||||
|
||||
SELECT cdb_geocoder_server.geocode_postalcode_point(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', '03204', 'spain');
|
||||
SELECT cdb_geocoder_server.cdb_geocode_postalcode_point(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', '03204', 'spain');
|
||||
|
||||
SELECT cdb_geocoder_server.geocode_postalcode_polygon(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', '03204');
|
||||
SELECT cdb_geocoder_server.cdb_geocode_postalcode_polygon(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', '03204');
|
||||
|
||||
SELECT cdb_geocoder_server.geocode_postalcode_polygon(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', '03204', 'spain');
|
||||
SELECT cdb_geocoder_server.cdb_geocode_postalcode_polygon(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', '03204', 'spain');
|
||||
|
||||
-- Clean dbs
|
||||
DELETE FROM global_postal_code_points;
|
||||
@ -64,54 +64,54 @@ SELECT exists(SELECT *
|
||||
FROM pg_proc p
|
||||
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
||||
WHERE ns.nspname = 'cdb_geocoder_server'
|
||||
AND proname = 'geocode_postalcode_point'
|
||||
AND proname = 'cdb_geocode_postalcode_point'
|
||||
AND oidvectortypes(p.proargtypes) = 'name, json, json, text');
|
||||
|
||||
SELECT exists(SELECT *
|
||||
FROM pg_proc p
|
||||
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
||||
WHERE ns.nspname = 'cdb_geocoder_server'
|
||||
AND proname = 'geocode_postalcode_point'
|
||||
AND proname = 'cdb_geocode_postalcode_point'
|
||||
AND oidvectortypes(p.proargtypes) = 'name, json, json, text, text');
|
||||
|
||||
SELECT exists(SELECT *
|
||||
FROM pg_proc p
|
||||
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
||||
WHERE ns.nspname = 'cdb_geocoder_server'
|
||||
AND proname = 'geocode_postalcode_polygon'
|
||||
AND proname = 'cdb_geocode_postalcode_polygon'
|
||||
AND oidvectortypes(p.proargtypes) = 'name, json, json, text');
|
||||
|
||||
SELECT exists(SELECT *
|
||||
FROM pg_proc p
|
||||
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
||||
WHERE ns.nspname = 'cdb_geocoder_server'
|
||||
AND proname = 'geocode_postalcode_polygon'
|
||||
AND proname = 'cdb_geocode_postalcode_polygon'
|
||||
AND oidvectortypes(p.proargtypes) = 'name, json, json, text, text');
|
||||
|
||||
SELECT exists(SELECT *
|
||||
FROM pg_proc p
|
||||
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
||||
WHERE ns.nspname = 'cdb_geocoder_server'
|
||||
AND proname = '_geocode_postalcode_point'
|
||||
AND proname = '_cdb_geocode_postalcode_point'
|
||||
AND oidvectortypes(p.proargtypes) = 'text');
|
||||
|
||||
SELECT exists(SELECT *
|
||||
FROM pg_proc p
|
||||
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
||||
WHERE ns.nspname = 'cdb_geocoder_server'
|
||||
AND proname = '_geocode_postalcode_point'
|
||||
AND proname = '_cdb_geocode_postalcode_point'
|
||||
AND oidvectortypes(p.proargtypes) = 'text, text');
|
||||
|
||||
SELECT exists(SELECT *
|
||||
FROM pg_proc p
|
||||
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
||||
WHERE ns.nspname = 'cdb_geocoder_server'
|
||||
AND proname = '_geocode_postalcode_polygon'
|
||||
AND proname = '_cdb_geocode_postalcode_polygon'
|
||||
AND oidvectortypes(p.proargtypes) = 'text');
|
||||
|
||||
SELECT exists(SELECT *
|
||||
FROM pg_proc p
|
||||
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
||||
WHERE ns.nspname = 'cdb_geocoder_server'
|
||||
AND proname = '_geocode_postalcode_polygon'
|
||||
AND proname = '_cdb_geocode_postalcode_polygon'
|
||||
AND oidvectortypes(p.proargtypes) = 'text, text');
|
@ -1,24 +1,24 @@
|
||||
-- Check that the public function is callable, even with no data
|
||||
-- It should return NULL
|
||||
SELECT cdb_geocoder_server.geocode_ipaddress_point(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', '0.0.0.0');
|
||||
SELECT cdb_geocoder_server.cdb_geocode_ipaddress_point(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', '0.0.0.0');
|
||||
|
||||
-- Insert dummy data into ip_address_locations
|
||||
INSERT INTO ip_address_locations VALUES ('::ffff:0.0.0.0'::inet, (ST_SetSRID(ST_MakePoint('40.40', '3.71'), 4326)));
|
||||
|
||||
-- This should return the polygon inserted above
|
||||
SELECT cdb_geocoder_server.geocode_ipaddress_point(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', '0.0.0.0');
|
||||
SELECT cdb_geocoder_server.cdb_geocode_ipaddress_point(session_user, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', '0.0.0.0');
|
||||
|
||||
-- Check for namedplaces signatures (point and polygon)
|
||||
SELECT exists(SELECT *
|
||||
FROM pg_proc p
|
||||
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
||||
WHERE ns.nspname = 'cdb_geocoder_server'
|
||||
AND proname = 'geocode_ipaddress_point'
|
||||
AND proname = 'cdb_geocode_ipaddress_point'
|
||||
AND oidvectortypes(p.proargtypes) = 'name, json, json, text');
|
||||
|
||||
SELECT exists(SELECT *
|
||||
FROM pg_proc p
|
||||
INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)
|
||||
WHERE ns.nspname = 'cdb_geocoder_server'
|
||||
AND proname = '_geocode_ipaddress_point'
|
||||
AND proname = '_cdb_geocode_ipaddress_point'
|
||||
AND oidvectortypes(p.proargtypes) = 'text');
|
Loading…
Reference in New Issue
Block a user