From 4b31a150272b87717945bc9aa2ef88488234c3fe Mon Sep 17 00:00:00 2001 From: Mario de Frutos Date: Fri, 5 Feb 2016 17:57:56 +0100 Subject: [PATCH] Geocoder client renamed to dataservices client extension --- client/Makefile | 8 +- client/README.md | 6 +- ...cdb_dataservices_client--0.0.1--0.1.0.sql} | 18 +- ...sql => cdb_dataservices_client--0.0.1.sql} | 142 +++---- ...cdb_dataservices_client--0.1.0--0.0.1.sql} | 12 +- client/cdb_dataservices_client--0.1.0.sql | 395 ++++++++++++++++++ client/cdb_dataservices_client.control | 5 + client/cdb_geocoder_client.control | 6 - client/renderer/sql-template-renderer | 3 +- .../templates/20_public_functions.erb | 6 +- .../templates/30_plproxy_functions.erb | 6 +- .../renderer/templates/90_grant_execute.erb | 2 +- client/sql/0.0.1/00_header.sql | 2 +- client/sql/0.0.1/10_geocoder_server_conn.sql | 4 +- client/sql/0.0.1/15_config_management.sql | 8 +- client/sql/0.0.1/80_permissions.sql | 6 +- client/sql/0.1.0/00_header.sql | 2 +- client/sql/0.1.0/10_geocoder_server_conn.sql | 4 +- client/sql/0.1.0/15_config_management.sql | 8 +- client/sql/0.1.0/80_permissions.sql | 6 +- .../0.0.1/expected/00_installation_test.out | 6 +- client/test/0.0.1/expected/10_admin0_test.out | 10 +- client/test/0.0.1/expected/20_admin1_test.out | 18 +- .../0.0.1/expected/30_namedplaces_test.out | 26 +- .../0.0.1/expected/40_postalcodes_test.out | 18 +- .../0.0.1/expected/50_ipaddresses_test.out | 10 +- .../0.0.1/expected/90_permissions_test.out | 38 +- .../test/0.0.1/sql/00_installation_test.sql | 6 +- client/test/0.0.1/sql/10_admin0_test.sql | 6 +- client/test/0.0.1/sql/20_admin1_test.sql | 10 +- client/test/0.0.1/sql/30_namedplaces_test.sql | 14 +- client/test/0.0.1/sql/40_postalcodes_test.sql | 10 +- client/test/0.0.1/sql/50_ipaddresses_test.sql | 6 +- client/test/0.0.1/sql/90_permissions_test.sql | 2 +- .../0.1.0/expected/00_installation_test.out | 6 +- client/test/0.1.0/expected/10_admin0_test.out | 10 +- client/test/0.1.0/expected/20_admin1_test.out | 18 +- .../0.1.0/expected/30_namedplaces_test.out | 26 +- .../0.1.0/expected/40_postalcodes_test.out | 18 +- .../0.1.0/expected/50_ipaddresses_test.out | 10 +- client/test/0.1.0/expected/60_street_test.out | 46 +- .../0.1.0/expected/90_permissions_test.out | 42 +- .../test/0.1.0/sql/00_installation_test.sql | 6 +- client/test/0.1.0/sql/10_admin0_test.sql | 6 +- client/test/0.1.0/sql/20_admin1_test.sql | 10 +- client/test/0.1.0/sql/30_namedplaces_test.sql | 14 +- client/test/0.1.0/sql/40_postalcodes_test.sql | 10 +- client/test/0.1.0/sql/50_ipaddresses_test.sql | 6 +- client/test/0.1.0/sql/60_street_test.sql | 6 +- client/test/0.1.0/sql/90_permissions_test.sql | 2 +- 50 files changed, 730 insertions(+), 335 deletions(-) rename client/{cdb_geocoder_client--0.0.1--0.1.0.sql => cdb_dataservices_client--0.0.1--0.1.0.sql} (60%) rename client/{cdb_geocoder_client--0.0.1.sql => cdb_dataservices_client--0.0.1.sql} (51%) rename client/{cdb_geocoder_client--0.1.0--0.0.1.sql => cdb_dataservices_client--0.1.0--0.0.1.sql} (69%) create mode 100644 client/cdb_dataservices_client--0.1.0.sql create mode 100644 client/cdb_dataservices_client.control delete mode 100644 client/cdb_geocoder_client.control diff --git a/client/Makefile b/client/Makefile index 2d6e96d..dd32709 100644 --- a/client/Makefile +++ b/client/Makefile @@ -1,6 +1,6 @@ # Makefile to generate the extension out of separate sql source files. # Once a version is released, it is not meant to be changed. E.g: once version 0.0.1 is out, it SHALL NOT be changed. -EXTENSION = cdb_geocoder_client +EXTENSION = cdb_dataservices_client EXTVERSION = $(shell grep default_version $(EXTENSION).control | sed -e "s/default_version[[:space:]]*=[[:space:]]*'\([^']*\)'/\1/") # The new version to be generated from templates @@ -11,9 +11,9 @@ NEW_EXTENSION_ARTIFACT = $(EXTENSION)--$(EXTVERSION).sql # for installation from scratch, upgrades and downgrades. # @see http://www.postgresql.org/docs/current/static/extend-pgxs.html DATA = $(NEW_EXTENSION_ARTIFACT) \ - cdb_geocoder_client--0.0.1.sql \ - cdb_geocoder_client--0.1.0--0.0.1.sql \ - cdb_geocoder_client--0.0.1--0.1.0.sql + cdb_dataservices_client--0.0.1.sql \ + cdb_dataservices_client--0.1.0--0.0.1.sql \ + cdb_dataservices_client--0.0.1--0.1.0.sql REGRESS = $(notdir $(basename $(wildcard test/$(EXTVERSION)/sql/*test.sql))) diff --git a/client/README.md b/client/README.md index 4f0b6e1..df533f4 100644 --- a/client/README.md +++ b/client/README.md @@ -1,5 +1,5 @@ -# CartoDB geocoder API client extension -Postgres extension for the CartoDB geocoder API, client side. +# CartoDB dataservices API client extension +Postgres extension for the CartoDB dataservices API, client side. ## Dependencies This extension is thought to be used on top of CartoDB geocoder extension, for the multiples available geocoders (internal, nokia, etc). @@ -37,7 +37,7 @@ psql -U postgres cartodb_dev_user_fe3b850a-01c0-48f9-8a26-a82f09e9b53f_db and then: ```sql -CREATE EXTENSION cdb_geocoder_client; +CREATE EXTENSION cdb_dataservices_client; ``` The extension creation in the user's db requires **superuser** privileges. diff --git a/client/cdb_geocoder_client--0.0.1--0.1.0.sql b/client/cdb_dataservices_client--0.0.1--0.1.0.sql similarity index 60% rename from client/cdb_geocoder_client--0.0.1--0.1.0.sql rename to client/cdb_dataservices_client--0.0.1--0.1.0.sql index 338eeb5..e532b52 100644 --- a/client/cdb_geocoder_client--0.0.1--0.1.0.sql +++ b/client/cdb_dataservices_client--0.0.1--0.1.0.sql @@ -4,10 +4,10 @@ -- The purpose of this function is to retrieve the username and organization name from -- a) schema where he/her is the owner in case is an organization user -- b) entity_name from the cdb_conf database in case is a non organization user -CREATE OR REPLACE FUNCTION cdb_geocoder_client._cdb_entity_config() +CREATE OR REPLACE FUNCTION cdb_dataservices_client._cdb_entity_config() RETURNS record AS $$ DECLARE - result cdb_geocoder_client._entity_config; + result cdb_dataservices_client._entity_config; is_organization boolean; username text; organization_name text; @@ -31,7 +31,7 @@ BEGIN END; $$ LANGUAGE 'plpgsql' SECURITY DEFINER; -CREATE OR REPLACE FUNCTION cdb_geocoder_client.cdb_geocode_street_point (searchtext text, city text DEFAULT NULL, state_province text DEFAULT NULL, country text DEFAULT NULL) +CREATE OR REPLACE FUNCTION cdb_dataservices_client.cdb_geocode_street_point (searchtext text, city text DEFAULT NULL, state_province text DEFAULT NULL, country text DEFAULT NULL) RETURNS Geometry AS $$ DECLARE ret Geometry; @@ -41,20 +41,20 @@ BEGIN IF session_user = 'publicuser' OR session_user ~ 'cartodb_publicuser_*' THEN RAISE EXCEPTION 'The api_key must be provided'; END IF; - SELECT u, o INTO username, orgname FROM cdb_geocoder_client._cdb_entity_config() AS (u text, o text); + SELECT u, o INTO username, orgname FROM cdb_dataservices_client._cdb_entity_config() AS (u text, o text); -- JSON value stored "" is taken as literal IF username IS NULL OR username = '' OR username = '""' THEN RAISE EXCEPTION 'Username is a mandatory argument, check it out'; END IF; - SELECT cdb_geocoder_client._cdb_geocode_street_point(username, orgname, searchtext, city, state_province, country) INTO ret; + SELECT cdb_dataservices_client._cdb_geocode_street_point(username, orgname, searchtext, city, state_province, country) INTO ret; RETURN ret; END; $$ LANGUAGE 'plpgsql' SECURITY DEFINER; -CREATE OR REPLACE FUNCTION cdb_geocoder_client._cdb_geocode_street_point (username text, organization_name text, searchtext text, city text DEFAULT NULL, state_province text DEFAULT NULL, country text DEFAULT NULL) +CREATE OR REPLACE FUNCTION cdb_dataservices_client._cdb_geocode_street_point (username text, organization_name text, searchtext text, city text DEFAULT NULL, state_province text DEFAULT NULL, country text DEFAULT NULL) RETURNS Geometry AS $$ - CONNECT cdb_geocoder_client._server_conn_str(); - SELECT cdb_geocoder_server.cdb_geocode_street_point (username, organization_name, searchtext, city, state_province, country); + CONNECT cdb_dataservices_client._server_conn_str(); + SELECT cdb_dataservices_server.cdb_geocode_street_point (username, organization_name, searchtext, city, state_province, country); $$ LANGUAGE plproxy; -GRANT EXECUTE ON FUNCTION cdb_geocoder_client.cdb_geocode_street_point(searchtext text, city text, state_province text, country text) TO publicuser; +GRANT EXECUTE ON FUNCTION cdb_dataservices_client.cdb_geocode_street_point(searchtext text, city text, state_province text, country text) TO publicuser; diff --git a/client/cdb_geocoder_client--0.0.1.sql b/client/cdb_dataservices_client--0.0.1.sql similarity index 51% rename from client/cdb_geocoder_client--0.0.1.sql rename to client/cdb_dataservices_client--0.0.1.sql index 846931c..a155df0 100644 --- a/client/cdb_geocoder_client--0.0.1.sql +++ b/client/cdb_dataservices_client--0.0.1.sql @@ -1,12 +1,12 @@ -- Complain if script is sourced in psql, rather than via CREATE EXTENSION -\echo Use "CREATE EXTENSION cdb_geocoder_client" to load this file. \quit +\echo Use "CREATE EXTENSION cdb_dataservices_client" to load this file. \quit -- -- Geocoder server connection config -- -- The purpose of this function is provide to the PL/Proxy functions -- the connection string needed to connect with the server -CREATE OR REPLACE FUNCTION cdb_geocoder_client._server_conn_str() +CREATE OR REPLACE FUNCTION cdb_dataservices_client._server_conn_str() RETURNS text AS $$ DECLARE db_connection_str text; @@ -15,7 +15,7 @@ BEGIN SELECT trim(both '"' FROM db_connection_str) INTO db_connection_str; RETURN db_connection_str; END; -$$ LANGUAGE 'plpgsql';CREATE TYPE cdb_geocoder_client._entity_config AS ( +$$ LANGUAGE 'plpgsql';CREATE TYPE cdb_dataservices_client._entity_config AS ( username text, organization_name text ); @@ -26,10 +26,10 @@ $$ LANGUAGE 'plpgsql';CREATE TYPE cdb_geocoder_client._entity_config AS ( -- The purpose of this function is to retrieve the username and organization name from -- a) schema where he/her is the owner in case is an organization user -- b) entity_name from the cdb_conf database in case is a non organization user -CREATE OR REPLACE FUNCTION cdb_geocoder_client._cdb_entity_config() +CREATE OR REPLACE FUNCTION cdb_dataservices_client._cdb_entity_config() RETURNS record AS $$ DECLARE - result cdb_geocoder_client._entity_config; + result cdb_dataservices_client._entity_config; is_organization boolean; username text; organization_name text; @@ -57,7 +57,7 @@ $$ LANGUAGE 'plpgsql' SECURITY DEFINER;-- -- These are the only ones with permissions to publicuser role -- and should also be the only ones with SECURITY DEFINER -CREATE OR REPLACE FUNCTION cdb_geocoder_client.cdb_geocode_admin0_polygon (country_name text) +CREATE OR REPLACE FUNCTION cdb_dataservices_client.cdb_geocode_admin0_polygon (country_name text) RETURNS Geometry AS $$ DECLARE ret Geometry; @@ -67,12 +67,12 @@ BEGIN IF session_user = 'publicuser' OR session_user ~ 'cartodb_publicuser_*' THEN RAISE EXCEPTION 'The api_key must be provided'; END IF; - SELECT u, o INTO username, orgname FROM cdb_geocoder_client._cdb_entity_config() AS (u text, o text); + SELECT u, o INTO username, orgname FROM cdb_dataservices_client._cdb_entity_config() AS (u text, o text); -- JSON value stored "" is taken as literal IF username IS NULL OR username = '' OR username = '""' THEN RAISE EXCEPTION 'Username is a mandatory argument, check it out'; END IF; - SELECT cdb_geocoder_client._cdb_geocode_admin0_polygon(username, orgname, country_name) INTO ret; + SELECT cdb_dataservices_client._cdb_geocode_admin0_polygon(username, orgname, country_name) INTO ret; RETURN ret; END; $$ LANGUAGE 'plpgsql' SECURITY DEFINER; @@ -83,7 +83,7 @@ $$ LANGUAGE 'plpgsql' SECURITY DEFINER; -- These are the only ones with permissions to publicuser role -- and should also be the only ones with SECURITY DEFINER -CREATE OR REPLACE FUNCTION cdb_geocoder_client.cdb_geocode_admin1_polygon (admin1_name text) +CREATE OR REPLACE FUNCTION cdb_dataservices_client.cdb_geocode_admin1_polygon (admin1_name text) RETURNS Geometry AS $$ DECLARE ret Geometry; @@ -93,12 +93,12 @@ BEGIN IF session_user = 'publicuser' OR session_user ~ 'cartodb_publicuser_*' THEN RAISE EXCEPTION 'The api_key must be provided'; END IF; - SELECT u, o INTO username, orgname FROM cdb_geocoder_client._cdb_entity_config() AS (u text, o text); + SELECT u, o INTO username, orgname FROM cdb_dataservices_client._cdb_entity_config() AS (u text, o text); -- JSON value stored "" is taken as literal IF username IS NULL OR username = '' OR username = '""' THEN RAISE EXCEPTION 'Username is a mandatory argument, check it out'; END IF; - SELECT cdb_geocoder_client._cdb_geocode_admin1_polygon(username, orgname, admin1_name) INTO ret; + SELECT cdb_dataservices_client._cdb_geocode_admin1_polygon(username, orgname, admin1_name) INTO ret; RETURN ret; END; $$ LANGUAGE 'plpgsql' SECURITY DEFINER; @@ -109,7 +109,7 @@ $$ LANGUAGE 'plpgsql' SECURITY DEFINER; -- These are the only ones with permissions to publicuser role -- and should also be the only ones with SECURITY DEFINER -CREATE OR REPLACE FUNCTION cdb_geocoder_client.cdb_geocode_admin1_polygon (admin1_name text, country_name text) +CREATE OR REPLACE FUNCTION cdb_dataservices_client.cdb_geocode_admin1_polygon (admin1_name text, country_name text) RETURNS Geometry AS $$ DECLARE ret Geometry; @@ -119,12 +119,12 @@ BEGIN IF session_user = 'publicuser' OR session_user ~ 'cartodb_publicuser_*' THEN RAISE EXCEPTION 'The api_key must be provided'; END IF; - SELECT u, o INTO username, orgname FROM cdb_geocoder_client._cdb_entity_config() AS (u text, o text); + SELECT u, o INTO username, orgname FROM cdb_dataservices_client._cdb_entity_config() AS (u text, o text); -- JSON value stored "" is taken as literal IF username IS NULL OR username = '' OR username = '""' THEN RAISE EXCEPTION 'Username is a mandatory argument, check it out'; END IF; - SELECT cdb_geocoder_client._cdb_geocode_admin1_polygon(username, orgname, admin1_name, country_name) INTO ret; + SELECT cdb_dataservices_client._cdb_geocode_admin1_polygon(username, orgname, admin1_name, country_name) INTO ret; RETURN ret; END; $$ LANGUAGE 'plpgsql' SECURITY DEFINER; @@ -135,7 +135,7 @@ $$ LANGUAGE 'plpgsql' SECURITY DEFINER; -- These are the only ones with permissions to publicuser role -- and should also be the only ones with SECURITY DEFINER -CREATE OR REPLACE FUNCTION cdb_geocoder_client.cdb_geocode_namedplace_point (city_name text) +CREATE OR REPLACE FUNCTION cdb_dataservices_client.cdb_geocode_namedplace_point (city_name text) RETURNS Geometry AS $$ DECLARE ret Geometry; @@ -145,12 +145,12 @@ BEGIN IF session_user = 'publicuser' OR session_user ~ 'cartodb_publicuser_*' THEN RAISE EXCEPTION 'The api_key must be provided'; END IF; - SELECT u, o INTO username, orgname FROM cdb_geocoder_client._cdb_entity_config() AS (u text, o text); + SELECT u, o INTO username, orgname FROM cdb_dataservices_client._cdb_entity_config() AS (u text, o text); -- JSON value stored "" is taken as literal IF username IS NULL OR username = '' OR username = '""' THEN RAISE EXCEPTION 'Username is a mandatory argument, check it out'; END IF; - SELECT cdb_geocoder_client._cdb_geocode_namedplace_point(username, orgname, city_name) INTO ret; + SELECT cdb_dataservices_client._cdb_geocode_namedplace_point(username, orgname, city_name) INTO ret; RETURN ret; END; $$ LANGUAGE 'plpgsql' SECURITY DEFINER; @@ -161,7 +161,7 @@ $$ LANGUAGE 'plpgsql' SECURITY DEFINER; -- These are the only ones with permissions to publicuser role -- and should also be the only ones with SECURITY DEFINER -CREATE OR REPLACE FUNCTION cdb_geocoder_client.cdb_geocode_namedplace_point (city_name text, country_name text) +CREATE OR REPLACE FUNCTION cdb_dataservices_client.cdb_geocode_namedplace_point (city_name text, country_name text) RETURNS Geometry AS $$ DECLARE ret Geometry; @@ -171,12 +171,12 @@ BEGIN IF session_user = 'publicuser' OR session_user ~ 'cartodb_publicuser_*' THEN RAISE EXCEPTION 'The api_key must be provided'; END IF; - SELECT u, o INTO username, orgname FROM cdb_geocoder_client._cdb_entity_config() AS (u text, o text); + SELECT u, o INTO username, orgname FROM cdb_dataservices_client._cdb_entity_config() AS (u text, o text); -- JSON value stored "" is taken as literal IF username IS NULL OR username = '' OR username = '""' THEN RAISE EXCEPTION 'Username is a mandatory argument, check it out'; END IF; - SELECT cdb_geocoder_client._cdb_geocode_namedplace_point(username, orgname, city_name, country_name) INTO ret; + SELECT cdb_dataservices_client._cdb_geocode_namedplace_point(username, orgname, city_name, country_name) INTO ret; RETURN ret; END; $$ LANGUAGE 'plpgsql' SECURITY DEFINER; @@ -187,7 +187,7 @@ $$ LANGUAGE 'plpgsql' SECURITY DEFINER; -- These are the only ones with permissions to publicuser role -- and should also be the only ones with SECURITY DEFINER -CREATE OR REPLACE FUNCTION cdb_geocoder_client.cdb_geocode_namedplace_point (city_name text, admin1_name text, country_name text) +CREATE OR REPLACE FUNCTION cdb_dataservices_client.cdb_geocode_namedplace_point (city_name text, admin1_name text, country_name text) RETURNS Geometry AS $$ DECLARE ret Geometry; @@ -197,12 +197,12 @@ BEGIN IF session_user = 'publicuser' OR session_user ~ 'cartodb_publicuser_*' THEN RAISE EXCEPTION 'The api_key must be provided'; END IF; - SELECT u, o INTO username, orgname FROM cdb_geocoder_client._cdb_entity_config() AS (u text, o text); + SELECT u, o INTO username, orgname FROM cdb_dataservices_client._cdb_entity_config() AS (u text, o text); -- JSON value stored "" is taken as literal IF username IS NULL OR username = '' OR username = '""' THEN RAISE EXCEPTION 'Username is a mandatory argument, check it out'; END IF; - SELECT cdb_geocoder_client._cdb_geocode_namedplace_point(username, orgname, city_name, admin1_name, country_name) INTO ret; + SELECT cdb_dataservices_client._cdb_geocode_namedplace_point(username, orgname, city_name, admin1_name, country_name) INTO ret; RETURN ret; END; $$ LANGUAGE 'plpgsql' SECURITY DEFINER; @@ -213,7 +213,7 @@ $$ LANGUAGE 'plpgsql' SECURITY DEFINER; -- These are the only ones with permissions to publicuser role -- and should also be the only ones with SECURITY DEFINER -CREATE OR REPLACE FUNCTION cdb_geocoder_client.cdb_geocode_postalcode_polygon (postal_code text, country_name text) +CREATE OR REPLACE FUNCTION cdb_dataservices_client.cdb_geocode_postalcode_polygon (postal_code text, country_name text) RETURNS Geometry AS $$ DECLARE ret Geometry; @@ -223,12 +223,12 @@ BEGIN IF session_user = 'publicuser' OR session_user ~ 'cartodb_publicuser_*' THEN RAISE EXCEPTION 'The api_key must be provided'; END IF; - SELECT u, o INTO username, orgname FROM cdb_geocoder_client._cdb_entity_config() AS (u text, o text); + SELECT u, o INTO username, orgname FROM cdb_dataservices_client._cdb_entity_config() AS (u text, o text); -- JSON value stored "" is taken as literal IF username IS NULL OR username = '' OR username = '""' THEN RAISE EXCEPTION 'Username is a mandatory argument, check it out'; END IF; - SELECT cdb_geocoder_client._cdb_geocode_postalcode_polygon(username, orgname, postal_code, country_name) INTO ret; + SELECT cdb_dataservices_client._cdb_geocode_postalcode_polygon(username, orgname, postal_code, country_name) INTO ret; RETURN ret; END; $$ LANGUAGE 'plpgsql' SECURITY DEFINER; @@ -239,7 +239,7 @@ $$ LANGUAGE 'plpgsql' SECURITY DEFINER; -- These are the only ones with permissions to publicuser role -- and should also be the only ones with SECURITY DEFINER -CREATE OR REPLACE FUNCTION cdb_geocoder_client.cdb_geocode_postalcode_point (postal_code text, country_name text) +CREATE OR REPLACE FUNCTION cdb_dataservices_client.cdb_geocode_postalcode_point (postal_code text, country_name text) RETURNS Geometry AS $$ DECLARE ret Geometry; @@ -249,12 +249,12 @@ BEGIN IF session_user = 'publicuser' OR session_user ~ 'cartodb_publicuser_*' THEN RAISE EXCEPTION 'The api_key must be provided'; END IF; - SELECT u, o INTO username, orgname FROM cdb_geocoder_client._cdb_entity_config() AS (u text, o text); + SELECT u, o INTO username, orgname FROM cdb_dataservices_client._cdb_entity_config() AS (u text, o text); -- JSON value stored "" is taken as literal IF username IS NULL OR username = '' OR username = '""' THEN RAISE EXCEPTION 'Username is a mandatory argument, check it out'; END IF; - SELECT cdb_geocoder_client._cdb_geocode_postalcode_point(username, orgname, postal_code, country_name) INTO ret; + SELECT cdb_dataservices_client._cdb_geocode_postalcode_point(username, orgname, postal_code, country_name) INTO ret; RETURN ret; END; $$ LANGUAGE 'plpgsql' SECURITY DEFINER; @@ -265,7 +265,7 @@ $$ LANGUAGE 'plpgsql' SECURITY DEFINER; -- These are the only ones with permissions to publicuser role -- and should also be the only ones with SECURITY DEFINER -CREATE OR REPLACE FUNCTION cdb_geocoder_client.cdb_geocode_ipaddress_point (ip_address text) +CREATE OR REPLACE FUNCTION cdb_dataservices_client.cdb_geocode_ipaddress_point (ip_address text) RETURNS Geometry AS $$ DECLARE ret Geometry; @@ -275,85 +275,85 @@ BEGIN IF session_user = 'publicuser' OR session_user ~ 'cartodb_publicuser_*' THEN RAISE EXCEPTION 'The api_key must be provided'; END IF; - SELECT u, o INTO username, orgname FROM cdb_geocoder_client._cdb_entity_config() AS (u text, o text); + SELECT u, o INTO username, orgname FROM cdb_dataservices_client._cdb_entity_config() AS (u text, o text); -- JSON value stored "" is taken as literal IF username IS NULL OR username = '' OR username = '""' THEN RAISE EXCEPTION 'Username is a mandatory argument, check it out'; END IF; - SELECT cdb_geocoder_client._cdb_geocode_ipaddress_point(username, orgname, ip_address) INTO ret; + SELECT cdb_dataservices_client._cdb_geocode_ipaddress_point(username, orgname, ip_address) INTO ret; RETURN ret; END; $$ LANGUAGE 'plpgsql' SECURITY DEFINER; -CREATE OR REPLACE FUNCTION cdb_geocoder_client._cdb_geocode_admin0_polygon (username text, organization_name text, country_name text) +CREATE OR REPLACE FUNCTION cdb_dataservices_client._cdb_geocode_admin0_polygon (username text, organization_name text, country_name text) RETURNS Geometry AS $$ - CONNECT cdb_geocoder_client._server_conn_str(); - SELECT cdb_geocoder_server.cdb_geocode_admin0_polygon (username, organization_name, country_name); + CONNECT cdb_dataservices_client._server_conn_str(); + SELECT cdb_dataservices_server.cdb_geocode_admin0_polygon (username, organization_name, country_name); $$ LANGUAGE plproxy; -CREATE OR REPLACE FUNCTION cdb_geocoder_client._cdb_geocode_admin1_polygon (username text, organization_name text, admin1_name text) +CREATE OR REPLACE FUNCTION cdb_dataservices_client._cdb_geocode_admin1_polygon (username text, organization_name text, admin1_name text) RETURNS Geometry AS $$ - CONNECT cdb_geocoder_client._server_conn_str(); - SELECT cdb_geocoder_server.cdb_geocode_admin1_polygon (username, organization_name, admin1_name); + CONNECT cdb_dataservices_client._server_conn_str(); + SELECT cdb_dataservices_server.cdb_geocode_admin1_polygon (username, organization_name, admin1_name); $$ LANGUAGE plproxy; -CREATE OR REPLACE FUNCTION cdb_geocoder_client._cdb_geocode_admin1_polygon (username text, organization_name text, admin1_name text, country_name text) +CREATE OR REPLACE FUNCTION cdb_dataservices_client._cdb_geocode_admin1_polygon (username text, organization_name text, admin1_name text, country_name text) RETURNS Geometry AS $$ - CONNECT cdb_geocoder_client._server_conn_str(); - SELECT cdb_geocoder_server.cdb_geocode_admin1_polygon (username, organization_name, admin1_name, country_name); + CONNECT cdb_dataservices_client._server_conn_str(); + SELECT cdb_dataservices_server.cdb_geocode_admin1_polygon (username, organization_name, admin1_name, country_name); $$ LANGUAGE plproxy; -CREATE OR REPLACE FUNCTION cdb_geocoder_client._cdb_geocode_namedplace_point (username text, organization_name text, city_name text) +CREATE OR REPLACE FUNCTION cdb_dataservices_client._cdb_geocode_namedplace_point (username text, organization_name text, city_name text) RETURNS Geometry AS $$ - CONNECT cdb_geocoder_client._server_conn_str(); - SELECT cdb_geocoder_server.cdb_geocode_namedplace_point (username, organization_name, city_name); + CONNECT cdb_dataservices_client._server_conn_str(); + SELECT cdb_dataservices_server.cdb_geocode_namedplace_point (username, organization_name, city_name); $$ LANGUAGE plproxy; -CREATE OR REPLACE FUNCTION cdb_geocoder_client._cdb_geocode_namedplace_point (username text, organization_name text, city_name text, country_name text) +CREATE OR REPLACE FUNCTION cdb_dataservices_client._cdb_geocode_namedplace_point (username text, organization_name text, city_name text, country_name text) RETURNS Geometry AS $$ - CONNECT cdb_geocoder_client._server_conn_str(); - SELECT cdb_geocoder_server.cdb_geocode_namedplace_point (username, organization_name, city_name, country_name); + CONNECT cdb_dataservices_client._server_conn_str(); + SELECT cdb_dataservices_server.cdb_geocode_namedplace_point (username, organization_name, city_name, country_name); $$ LANGUAGE plproxy; -CREATE OR REPLACE FUNCTION cdb_geocoder_client._cdb_geocode_namedplace_point (username text, organization_name text, city_name text, admin1_name text, country_name text) +CREATE OR REPLACE FUNCTION cdb_dataservices_client._cdb_geocode_namedplace_point (username text, organization_name text, city_name text, admin1_name text, country_name text) RETURNS Geometry AS $$ - CONNECT cdb_geocoder_client._server_conn_str(); - SELECT cdb_geocoder_server.cdb_geocode_namedplace_point (username, organization_name, city_name, admin1_name, country_name); + CONNECT cdb_dataservices_client._server_conn_str(); + SELECT cdb_dataservices_server.cdb_geocode_namedplace_point (username, organization_name, city_name, admin1_name, country_name); $$ LANGUAGE plproxy; -CREATE OR REPLACE FUNCTION cdb_geocoder_client._cdb_geocode_postalcode_polygon (username text, organization_name text, postal_code text, country_name text) +CREATE OR REPLACE FUNCTION cdb_dataservices_client._cdb_geocode_postalcode_polygon (username text, organization_name text, postal_code text, country_name text) RETURNS Geometry AS $$ - CONNECT cdb_geocoder_client._server_conn_str(); - SELECT cdb_geocoder_server.cdb_geocode_postalcode_polygon (username, organization_name, postal_code, country_name); + CONNECT cdb_dataservices_client._server_conn_str(); + SELECT cdb_dataservices_server.cdb_geocode_postalcode_polygon (username, organization_name, postal_code, country_name); $$ LANGUAGE plproxy; -CREATE OR REPLACE FUNCTION cdb_geocoder_client._cdb_geocode_postalcode_point (username text, organization_name text, postal_code text, country_name text) +CREATE OR REPLACE FUNCTION cdb_dataservices_client._cdb_geocode_postalcode_point (username text, organization_name text, postal_code text, country_name text) RETURNS Geometry AS $$ - CONNECT cdb_geocoder_client._server_conn_str(); - SELECT cdb_geocoder_server.cdb_geocode_postalcode_point (username, organization_name, postal_code, country_name); + CONNECT cdb_dataservices_client._server_conn_str(); + SELECT cdb_dataservices_server.cdb_geocode_postalcode_point (username, organization_name, postal_code, country_name); $$ LANGUAGE plproxy; -CREATE OR REPLACE FUNCTION cdb_geocoder_client._cdb_geocode_ipaddress_point (username text, organization_name text, ip_address text) +CREATE OR REPLACE FUNCTION cdb_dataservices_client._cdb_geocode_ipaddress_point (username text, organization_name text, ip_address text) RETURNS Geometry AS $$ - CONNECT cdb_geocoder_client._server_conn_str(); - SELECT cdb_geocoder_server.cdb_geocode_ipaddress_point (username, organization_name, ip_address); + CONNECT cdb_dataservices_client._server_conn_str(); + SELECT cdb_dataservices_server.cdb_geocode_ipaddress_point (username, organization_name, ip_address); $$ LANGUAGE plproxy; -- Make sure by default there are no permissions for publicuser -- NOTE: this happens at extension creation time, as part of an implicit transaction. -REVOKE ALL PRIVILEGES ON SCHEMA cdb_geocoder_client FROM PUBLIC, publicuser CASCADE; +REVOKE ALL PRIVILEGES ON SCHEMA cdb_dataservices_client FROM PUBLIC, publicuser CASCADE; -- Grant permissions on the schema to publicuser (but just the schema) -GRANT USAGE ON SCHEMA cdb_geocoder_client TO publicuser; +GRANT USAGE ON SCHEMA cdb_dataservices_client TO publicuser; -- Revoke execute permissions on all functions in the schema by default -REVOKE EXECUTE ON ALL FUNCTIONS IN SCHEMA cdb_geocoder_client FROM PUBLIC, publicuser; -GRANT EXECUTE ON FUNCTION cdb_geocoder_client.cdb_geocode_admin0_polygon(country_name text) TO publicuser; -GRANT EXECUTE ON FUNCTION cdb_geocoder_client.cdb_geocode_admin1_polygon(admin1_name text) TO publicuser; -GRANT EXECUTE ON FUNCTION cdb_geocoder_client.cdb_geocode_admin1_polygon(admin1_name text, country_name text) TO publicuser; -GRANT EXECUTE ON FUNCTION cdb_geocoder_client.cdb_geocode_namedplace_point(city_name text) TO publicuser; -GRANT EXECUTE ON FUNCTION cdb_geocoder_client.cdb_geocode_namedplace_point(city_name text, country_name text) TO publicuser; -GRANT EXECUTE ON FUNCTION cdb_geocoder_client.cdb_geocode_namedplace_point(city_name text, admin1_name text, country_name text) TO publicuser; -GRANT EXECUTE ON FUNCTION cdb_geocoder_client.cdb_geocode_postalcode_polygon(postal_code text, country_name text) TO publicuser; -GRANT EXECUTE ON FUNCTION cdb_geocoder_client.cdb_geocode_postalcode_point(postal_code text, country_name text) TO publicuser; -GRANT EXECUTE ON FUNCTION cdb_geocoder_client.cdb_geocode_ipaddress_point(ip_address text) TO publicuser; +REVOKE EXECUTE ON ALL FUNCTIONS IN SCHEMA cdb_dataservices_client FROM PUBLIC, publicuser; +GRANT EXECUTE ON FUNCTION cdb_dataservices_client.cdb_geocode_admin0_polygon(country_name text) TO publicuser; +GRANT EXECUTE ON FUNCTION cdb_dataservices_client.cdb_geocode_admin1_polygon(admin1_name text) TO publicuser; +GRANT EXECUTE ON FUNCTION cdb_dataservices_client.cdb_geocode_admin1_polygon(admin1_name text, country_name text) TO publicuser; +GRANT EXECUTE ON FUNCTION cdb_dataservices_client.cdb_geocode_namedplace_point(city_name text) TO publicuser; +GRANT EXECUTE ON FUNCTION cdb_dataservices_client.cdb_geocode_namedplace_point(city_name text, country_name text) TO publicuser; +GRANT EXECUTE ON FUNCTION cdb_dataservices_client.cdb_geocode_namedplace_point(city_name text, admin1_name text, country_name text) TO publicuser; +GRANT EXECUTE ON FUNCTION cdb_dataservices_client.cdb_geocode_postalcode_polygon(postal_code text, country_name text) TO publicuser; +GRANT EXECUTE ON FUNCTION cdb_dataservices_client.cdb_geocode_postalcode_point(postal_code text, country_name text) TO publicuser; +GRANT EXECUTE ON FUNCTION cdb_dataservices_client.cdb_geocode_ipaddress_point(ip_address text) TO publicuser; diff --git a/client/cdb_geocoder_client--0.1.0--0.0.1.sql b/client/cdb_dataservices_client--0.1.0--0.0.1.sql similarity index 69% rename from client/cdb_geocoder_client--0.1.0--0.0.1.sql rename to client/cdb_dataservices_client--0.1.0--0.0.1.sql index c9f3f45..040cd9d 100644 --- a/client/cdb_geocoder_client--0.1.0--0.0.1.sql +++ b/client/cdb_dataservices_client--0.1.0--0.0.1.sql @@ -1,8 +1,8 @@ -DROP FUNCTION IF EXISTS cdb_geocoder_client.cdb_geocode_street_point (text, text, text, text); -DROP FUNCTION IF EXISTS cdb_geocoder_client._cdb_geocode_street_point (text, text, text, text); +DROP FUNCTION IF EXISTS cdb_dataservices_client.cdb_geocode_street_point (text, text, text, text); +DROP FUNCTION IF EXISTS cdb_dataservices_client._cdb_geocode_street_point (text, text, text, text); -- This functions could exists due a first deploy with this name -DROP FUNCTION IF EXISTS cdb_geocoder_client.cdb_geocode_street_point_v2 (text, text, text, text); -DROP FUNCTION IF EXISTS cdb_geocoder_client._cdb_geocode_street_point_v2 (text, text, text, text, text, text); +DROP FUNCTION IF EXISTS cdb_dataservices_client.cdb_geocode_street_point_v2 (text, text, text, text); +DROP FUNCTION IF EXISTS cdb_dataservices_client._cdb_geocode_street_point_v2 (text, text, text, text, text, text); -- -- Get entity config function @@ -10,10 +10,10 @@ DROP FUNCTION IF EXISTS cdb_geocoder_client._cdb_geocode_street_point_v2 (text, -- The purpose of this function is to retrieve the username and organization name from -- a) schema where he/her is the owner in case is an organization user -- b) entity_name from the cdb_conf database in case is a non organization user -CREATE OR REPLACE FUNCTION cdb_geocoder_client._cdb_entity_config() +CREATE OR REPLACE FUNCTION cdb_dataservices_client._cdb_entity_config() RETURNS record AS $$ DECLARE - result cdb_geocoder_client._entity_config; + result cdb_dataservices_client._entity_config; is_organization boolean; username text; organization_name text; diff --git a/client/cdb_dataservices_client--0.1.0.sql b/client/cdb_dataservices_client--0.1.0.sql new file mode 100644 index 0000000..55e4333 --- /dev/null +++ b/client/cdb_dataservices_client--0.1.0.sql @@ -0,0 +1,395 @@ +--DO NOT MODIFY THIS FILE, IT IS GENERATED AUTOMATICALLY FROM SOURCES +-- Complain if script is sourced in psql, rather than via CREATE EXTENSION +\echo Use "CREATE EXTENSION cdb_dataservices_client" to load this file. \quit +-- +-- Geocoder server connection config +-- +-- The purpose of this function is provide to the PL/Proxy functions +-- the connection string needed to connect with the server + +CREATE OR REPLACE FUNCTION cdb_dataservices_client._server_conn_str() +RETURNS text AS $$ +DECLARE + db_connection_str text; +BEGIN + SELECT cartodb.cdb_conf_getconf('geocoder_server_config')->'connection_str' INTO db_connection_str; + SELECT trim(both '"' FROM db_connection_str) INTO db_connection_str; + RETURN db_connection_str; +END; +$$ LANGUAGE 'plpgsql'; +CREATE TYPE cdb_dataservices_client._entity_config AS ( + username text, + organization_name text +); + +-- +-- Get entity config function +-- +-- The purpose of this function is to retrieve the username and organization name from +-- a) schema where he/her is the owner in case is an organization user +-- b) entity_name from the cdb_conf database in case is a non organization user +CREATE OR REPLACE FUNCTION cdb_dataservices_client._cdb_entity_config() +RETURNS record AS $$ +DECLARE + result cdb_dataservices_client._entity_config; + is_organization boolean; + username text; + organization_name text; +BEGIN + SELECT cartodb.cdb_conf_getconf('user_config')->'is_organization' INTO is_organization; + IF is_organization IS NULL THEN + RAISE EXCEPTION 'User must have user configuration in the config table'; + ELSIF is_organization = TRUE THEN + SELECT nspname + FROM pg_namespace s + LEFT JOIN pg_roles r ON s.nspowner = r.oid + WHERE r.rolname = session_user INTO username; + SELECT cartodb.cdb_conf_getconf('user_config')->>'entity_name' INTO organization_name; + ELSE + SELECT cartodb.cdb_conf_getconf('user_config')->>'entity_name' INTO username; + organization_name = NULL; + END IF; + result.username = username; + result.organization_name = organization_name; + RETURN result; +END; +$$ LANGUAGE 'plpgsql' SECURITY DEFINER; +-- +-- Public geocoder API function +-- +-- These are the only ones with permissions to publicuser role +-- and should also be the only ones with SECURITY DEFINER + +CREATE OR REPLACE FUNCTION cdb_dataservices_client.cdb_geocode_admin0_polygon (country_name text) +RETURNS Geometry AS $$ +DECLARE + ret Geometry; + username text; + orgname text; +BEGIN + IF session_user = 'publicuser' OR session_user ~ 'cartodb_publicuser_*' THEN + RAISE EXCEPTION 'The api_key must be provided'; + END IF; + SELECT u, o INTO username, orgname FROM cdb_dataservices_client._cdb_entity_config() AS (u text, o text); + -- JSON value stored "" is taken as literal + IF username IS NULL OR username = '' OR username = '""' THEN + RAISE EXCEPTION 'Username is a mandatory argument, check it out'; + END IF; + SELECT cdb_dataservices_client._cdb_geocode_admin0_polygon(username, orgname, country_name) INTO ret; + RETURN ret; +END; +$$ LANGUAGE 'plpgsql' SECURITY DEFINER; + +-- +-- Public geocoder API function +-- +-- These are the only ones with permissions to publicuser role +-- and should also be the only ones with SECURITY DEFINER + +CREATE OR REPLACE FUNCTION cdb_dataservices_client.cdb_geocode_admin1_polygon (admin1_name text) +RETURNS Geometry AS $$ +DECLARE + ret Geometry; + username text; + orgname text; +BEGIN + IF session_user = 'publicuser' OR session_user ~ 'cartodb_publicuser_*' THEN + RAISE EXCEPTION 'The api_key must be provided'; + END IF; + SELECT u, o INTO username, orgname FROM cdb_dataservices_client._cdb_entity_config() AS (u text, o text); + -- JSON value stored "" is taken as literal + IF username IS NULL OR username = '' OR username = '""' THEN + RAISE EXCEPTION 'Username is a mandatory argument, check it out'; + END IF; + SELECT cdb_dataservices_client._cdb_geocode_admin1_polygon(username, orgname, admin1_name) INTO ret; + RETURN ret; +END; +$$ LANGUAGE 'plpgsql' SECURITY DEFINER; + +-- +-- Public geocoder API function +-- +-- These are the only ones with permissions to publicuser role +-- and should also be the only ones with SECURITY DEFINER + +CREATE OR REPLACE FUNCTION cdb_dataservices_client.cdb_geocode_admin1_polygon (admin1_name text, country_name text) +RETURNS Geometry AS $$ +DECLARE + ret Geometry; + username text; + orgname text; +BEGIN + IF session_user = 'publicuser' OR session_user ~ 'cartodb_publicuser_*' THEN + RAISE EXCEPTION 'The api_key must be provided'; + END IF; + SELECT u, o INTO username, orgname FROM cdb_dataservices_client._cdb_entity_config() AS (u text, o text); + -- JSON value stored "" is taken as literal + IF username IS NULL OR username = '' OR username = '""' THEN + RAISE EXCEPTION 'Username is a mandatory argument, check it out'; + END IF; + SELECT cdb_dataservices_client._cdb_geocode_admin1_polygon(username, orgname, admin1_name, country_name) INTO ret; + RETURN ret; +END; +$$ LANGUAGE 'plpgsql' SECURITY DEFINER; + +-- +-- Public geocoder API function +-- +-- These are the only ones with permissions to publicuser role +-- and should also be the only ones with SECURITY DEFINER + +CREATE OR REPLACE FUNCTION cdb_dataservices_client.cdb_geocode_namedplace_point (city_name text) +RETURNS Geometry AS $$ +DECLARE + ret Geometry; + username text; + orgname text; +BEGIN + IF session_user = 'publicuser' OR session_user ~ 'cartodb_publicuser_*' THEN + RAISE EXCEPTION 'The api_key must be provided'; + END IF; + SELECT u, o INTO username, orgname FROM cdb_dataservices_client._cdb_entity_config() AS (u text, o text); + -- JSON value stored "" is taken as literal + IF username IS NULL OR username = '' OR username = '""' THEN + RAISE EXCEPTION 'Username is a mandatory argument, check it out'; + END IF; + SELECT cdb_dataservices_client._cdb_geocode_namedplace_point(username, orgname, city_name) INTO ret; + RETURN ret; +END; +$$ LANGUAGE 'plpgsql' SECURITY DEFINER; + +-- +-- Public geocoder API function +-- +-- These are the only ones with permissions to publicuser role +-- and should also be the only ones with SECURITY DEFINER + +CREATE OR REPLACE FUNCTION cdb_dataservices_client.cdb_geocode_namedplace_point (city_name text, country_name text) +RETURNS Geometry AS $$ +DECLARE + ret Geometry; + username text; + orgname text; +BEGIN + IF session_user = 'publicuser' OR session_user ~ 'cartodb_publicuser_*' THEN + RAISE EXCEPTION 'The api_key must be provided'; + END IF; + SELECT u, o INTO username, orgname FROM cdb_dataservices_client._cdb_entity_config() AS (u text, o text); + -- JSON value stored "" is taken as literal + IF username IS NULL OR username = '' OR username = '""' THEN + RAISE EXCEPTION 'Username is a mandatory argument, check it out'; + END IF; + SELECT cdb_dataservices_client._cdb_geocode_namedplace_point(username, orgname, city_name, country_name) INTO ret; + RETURN ret; +END; +$$ LANGUAGE 'plpgsql' SECURITY DEFINER; + +-- +-- Public geocoder API function +-- +-- These are the only ones with permissions to publicuser role +-- and should also be the only ones with SECURITY DEFINER + +CREATE OR REPLACE FUNCTION cdb_dataservices_client.cdb_geocode_namedplace_point (city_name text, admin1_name text, country_name text) +RETURNS Geometry AS $$ +DECLARE + ret Geometry; + username text; + orgname text; +BEGIN + IF session_user = 'publicuser' OR session_user ~ 'cartodb_publicuser_*' THEN + RAISE EXCEPTION 'The api_key must be provided'; + END IF; + SELECT u, o INTO username, orgname FROM cdb_dataservices_client._cdb_entity_config() AS (u text, o text); + -- JSON value stored "" is taken as literal + IF username IS NULL OR username = '' OR username = '""' THEN + RAISE EXCEPTION 'Username is a mandatory argument, check it out'; + END IF; + SELECT cdb_dataservices_client._cdb_geocode_namedplace_point(username, orgname, city_name, admin1_name, country_name) INTO ret; + RETURN ret; +END; +$$ LANGUAGE 'plpgsql' SECURITY DEFINER; + +-- +-- Public geocoder API function +-- +-- These are the only ones with permissions to publicuser role +-- and should also be the only ones with SECURITY DEFINER + +CREATE OR REPLACE FUNCTION cdb_dataservices_client.cdb_geocode_postalcode_polygon (postal_code text, country_name text) +RETURNS Geometry AS $$ +DECLARE + ret Geometry; + username text; + orgname text; +BEGIN + IF session_user = 'publicuser' OR session_user ~ 'cartodb_publicuser_*' THEN + RAISE EXCEPTION 'The api_key must be provided'; + END IF; + SELECT u, o INTO username, orgname FROM cdb_dataservices_client._cdb_entity_config() AS (u text, o text); + -- JSON value stored "" is taken as literal + IF username IS NULL OR username = '' OR username = '""' THEN + RAISE EXCEPTION 'Username is a mandatory argument, check it out'; + END IF; + SELECT cdb_dataservices_client._cdb_geocode_postalcode_polygon(username, orgname, postal_code, country_name) INTO ret; + RETURN ret; +END; +$$ LANGUAGE 'plpgsql' SECURITY DEFINER; + +-- +-- Public geocoder API function +-- +-- These are the only ones with permissions to publicuser role +-- and should also be the only ones with SECURITY DEFINER + +CREATE OR REPLACE FUNCTION cdb_dataservices_client.cdb_geocode_postalcode_point (postal_code text, country_name text) +RETURNS Geometry AS $$ +DECLARE + ret Geometry; + username text; + orgname text; +BEGIN + IF session_user = 'publicuser' OR session_user ~ 'cartodb_publicuser_*' THEN + RAISE EXCEPTION 'The api_key must be provided'; + END IF; + SELECT u, o INTO username, orgname FROM cdb_dataservices_client._cdb_entity_config() AS (u text, o text); + -- JSON value stored "" is taken as literal + IF username IS NULL OR username = '' OR username = '""' THEN + RAISE EXCEPTION 'Username is a mandatory argument, check it out'; + END IF; + SELECT cdb_dataservices_client._cdb_geocode_postalcode_point(username, orgname, postal_code, country_name) INTO ret; + RETURN ret; +END; +$$ LANGUAGE 'plpgsql' SECURITY DEFINER; + +-- +-- Public geocoder API function +-- +-- These are the only ones with permissions to publicuser role +-- and should also be the only ones with SECURITY DEFINER + +CREATE OR REPLACE FUNCTION cdb_dataservices_client.cdb_geocode_ipaddress_point (ip_address text) +RETURNS Geometry AS $$ +DECLARE + ret Geometry; + username text; + orgname text; +BEGIN + IF session_user = 'publicuser' OR session_user ~ 'cartodb_publicuser_*' THEN + RAISE EXCEPTION 'The api_key must be provided'; + END IF; + SELECT u, o INTO username, orgname FROM cdb_dataservices_client._cdb_entity_config() AS (u text, o text); + -- JSON value stored "" is taken as literal + IF username IS NULL OR username = '' OR username = '""' THEN + RAISE EXCEPTION 'Username is a mandatory argument, check it out'; + END IF; + SELECT cdb_dataservices_client._cdb_geocode_ipaddress_point(username, orgname, ip_address) INTO ret; + RETURN ret; +END; +$$ LANGUAGE 'plpgsql' SECURITY DEFINER; + +-- +-- Public geocoder API function +-- +-- These are the only ones with permissions to publicuser role +-- and should also be the only ones with SECURITY DEFINER + +CREATE OR REPLACE FUNCTION cdb_dataservices_client.cdb_geocode_street_point (searchtext text, city text DEFAULT NULL, state_province text DEFAULT NULL, country text DEFAULT NULL) +RETURNS Geometry AS $$ +DECLARE + ret Geometry; + username text; + orgname text; +BEGIN + IF session_user = 'publicuser' OR session_user ~ 'cartodb_publicuser_*' THEN + RAISE EXCEPTION 'The api_key must be provided'; + END IF; + SELECT u, o INTO username, orgname FROM cdb_dataservices_client._cdb_entity_config() AS (u text, o text); + -- JSON value stored "" is taken as literal + IF username IS NULL OR username = '' OR username = '""' THEN + RAISE EXCEPTION 'Username is a mandatory argument, check it out'; + END IF; + SELECT cdb_dataservices_client._cdb_geocode_street_point(username, orgname, searchtext, city, state_province, country) INTO ret; + RETURN ret; +END; +$$ LANGUAGE 'plpgsql' SECURITY DEFINER; + +CREATE OR REPLACE FUNCTION cdb_dataservices_client._cdb_geocode_admin0_polygon (username text, organization_name text, country_name text) +RETURNS Geometry AS $$ + CONNECT cdb_dataservices_client._server_conn_str(); + SELECT cdb_dataservices_server.cdb_geocode_admin0_polygon (username, organization_name, country_name); +$$ LANGUAGE plproxy; + +CREATE OR REPLACE FUNCTION cdb_dataservices_client._cdb_geocode_admin1_polygon (username text, organization_name text, admin1_name text) +RETURNS Geometry AS $$ + CONNECT cdb_dataservices_client._server_conn_str(); + SELECT cdb_dataservices_server.cdb_geocode_admin1_polygon (username, organization_name, admin1_name); +$$ LANGUAGE plproxy; + +CREATE OR REPLACE FUNCTION cdb_dataservices_client._cdb_geocode_admin1_polygon (username text, organization_name text, admin1_name text, country_name text) +RETURNS Geometry AS $$ + CONNECT cdb_dataservices_client._server_conn_str(); + SELECT cdb_dataservices_server.cdb_geocode_admin1_polygon (username, organization_name, admin1_name, country_name); +$$ LANGUAGE plproxy; + +CREATE OR REPLACE FUNCTION cdb_dataservices_client._cdb_geocode_namedplace_point (username text, organization_name text, city_name text) +RETURNS Geometry AS $$ + CONNECT cdb_dataservices_client._server_conn_str(); + SELECT cdb_dataservices_server.cdb_geocode_namedplace_point (username, organization_name, city_name); +$$ LANGUAGE plproxy; + +CREATE OR REPLACE FUNCTION cdb_dataservices_client._cdb_geocode_namedplace_point (username text, organization_name text, city_name text, country_name text) +RETURNS Geometry AS $$ + CONNECT cdb_dataservices_client._server_conn_str(); + SELECT cdb_dataservices_server.cdb_geocode_namedplace_point (username, organization_name, city_name, country_name); +$$ LANGUAGE plproxy; + +CREATE OR REPLACE FUNCTION cdb_dataservices_client._cdb_geocode_namedplace_point (username text, organization_name text, city_name text, admin1_name text, country_name text) +RETURNS Geometry AS $$ + CONNECT cdb_dataservices_client._server_conn_str(); + SELECT cdb_dataservices_server.cdb_geocode_namedplace_point (username, organization_name, city_name, admin1_name, country_name); +$$ LANGUAGE plproxy; + +CREATE OR REPLACE FUNCTION cdb_dataservices_client._cdb_geocode_postalcode_polygon (username text, organization_name text, postal_code text, country_name text) +RETURNS Geometry AS $$ + CONNECT cdb_dataservices_client._server_conn_str(); + SELECT cdb_dataservices_server.cdb_geocode_postalcode_polygon (username, organization_name, postal_code, country_name); +$$ LANGUAGE plproxy; + +CREATE OR REPLACE FUNCTION cdb_dataservices_client._cdb_geocode_postalcode_point (username text, organization_name text, postal_code text, country_name text) +RETURNS Geometry AS $$ + CONNECT cdb_dataservices_client._server_conn_str(); + SELECT cdb_dataservices_server.cdb_geocode_postalcode_point (username, organization_name, postal_code, country_name); +$$ LANGUAGE plproxy; + +CREATE OR REPLACE FUNCTION cdb_dataservices_client._cdb_geocode_ipaddress_point (username text, organization_name text, ip_address text) +RETURNS Geometry AS $$ + CONNECT cdb_dataservices_client._server_conn_str(); + SELECT cdb_dataservices_server.cdb_geocode_ipaddress_point (username, organization_name, ip_address); +$$ LANGUAGE plproxy; + +CREATE OR REPLACE FUNCTION cdb_dataservices_client._cdb_geocode_street_point (username text, organization_name text, searchtext text, city text DEFAULT NULL, state_province text DEFAULT NULL, country text DEFAULT NULL) +RETURNS Geometry AS $$ + CONNECT cdb_dataservices_client._server_conn_str(); + SELECT cdb_dataservices_server.cdb_geocode_street_point (username, organization_name, searchtext, city, state_province, country); +$$ LANGUAGE plproxy; + +-- Make sure by default there are no permissions for publicuser +-- NOTE: this happens at extension creation time, as part of an implicit transaction. +REVOKE ALL PRIVILEGES ON SCHEMA cdb_dataservices_client FROM PUBLIC, publicuser CASCADE; + +-- Grant permissions on the schema to publicuser (but just the schema) +GRANT USAGE ON SCHEMA cdb_dataservices_client TO publicuser; + +-- Revoke execute permissions on all functions in the schema by default +REVOKE EXECUTE ON ALL FUNCTIONS IN SCHEMA cdb_dataservices_client FROM PUBLIC, publicuser; +GRANT EXECUTE ON FUNCTION cdb_dataservices_client.cdb_geocode_admin0_polygon(country_name text) TO publicuser; +GRANT EXECUTE ON FUNCTION cdb_dataservices_client.cdb_geocode_admin1_polygon(admin1_name text) TO publicuser; +GRANT EXECUTE ON FUNCTION cdb_dataservices_client.cdb_geocode_admin1_polygon(admin1_name text, country_name text) TO publicuser; +GRANT EXECUTE ON FUNCTION cdb_dataservices_client.cdb_geocode_namedplace_point(city_name text) TO publicuser; +GRANT EXECUTE ON FUNCTION cdb_dataservices_client.cdb_geocode_namedplace_point(city_name text, country_name text) TO publicuser; +GRANT EXECUTE ON FUNCTION cdb_dataservices_client.cdb_geocode_namedplace_point(city_name text, admin1_name text, country_name text) TO publicuser; +GRANT EXECUTE ON FUNCTION cdb_dataservices_client.cdb_geocode_postalcode_polygon(postal_code text, country_name text) TO publicuser; +GRANT EXECUTE ON FUNCTION cdb_dataservices_client.cdb_geocode_postalcode_point(postal_code text, country_name text) TO publicuser; +GRANT EXECUTE ON FUNCTION cdb_dataservices_client.cdb_geocode_ipaddress_point(ip_address text) TO publicuser; +GRANT EXECUTE ON FUNCTION cdb_dataservices_client.cdb_geocode_street_point(searchtext text, city text, state_province text, country text) TO publicuser; diff --git a/client/cdb_dataservices_client.control b/client/cdb_dataservices_client.control new file mode 100644 index 0000000..f060043 --- /dev/null +++ b/client/cdb_dataservices_client.control @@ -0,0 +1,5 @@ +comment = 'CartoDB dataservices client API extension' +default_version = '0.1.0' +requires = 'plproxy, cartodb' +superuser = true +schema = cdb_dataservices_client diff --git a/client/cdb_geocoder_client.control b/client/cdb_geocoder_client.control deleted file mode 100644 index 4d1f047..0000000 --- a/client/cdb_geocoder_client.control +++ /dev/null @@ -1,6 +0,0 @@ -# CartoDB geocoder client API extension -comment = 'CartoDB geocoder client API extension' -default_version = '0.1.0' -requires = 'plproxy, cartodb' -superuser = true -schema = cdb_geocoder_client diff --git a/client/renderer/sql-template-renderer b/client/renderer/sql-template-renderer index 8938db8..e9d5be2 100755 --- a/client/renderer/sql-template-renderer +++ b/client/renderer/sql-template-renderer @@ -8,7 +8,8 @@ require 'erb' class SqlTemplateRenderer - GEOCODER_CLIENT_SCHEMA = 'cdb_geocoder_client' + DATASERVICES_CLIENT_SCHEMA = 'cdb_dataservices_client' + DATASERVICES_SERVER_SCHEMA = 'cdb_dataservices_server' def initialize(template_file, function_signature) @function_signature = function_signature diff --git a/client/renderer/templates/20_public_functions.erb b/client/renderer/templates/20_public_functions.erb index 39a7c06..da1b81c 100644 --- a/client/renderer/templates/20_public_functions.erb +++ b/client/renderer/templates/20_public_functions.erb @@ -4,7 +4,7 @@ -- These are the only ones with permissions to publicuser role -- and should also be the only ones with SECURITY DEFINER -CREATE OR REPLACE FUNCTION <%= GEOCODER_CLIENT_SCHEMA %>.<%= name %> (<%= params_with_type_and_default %>) +CREATE OR REPLACE FUNCTION <%= DATASERVICES_CLIENT_SCHEMA %>.<%= name %> (<%= params_with_type_and_default %>) RETURNS <%= return_type %> AS $$ DECLARE ret <%= return_type %>; @@ -14,12 +14,12 @@ BEGIN IF session_user = 'publicuser' OR session_user ~ 'cartodb_publicuser_*' THEN RAISE EXCEPTION 'The api_key must be provided'; END IF; - SELECT u, o INTO username, orgname FROM <%= GEOCODER_CLIENT_SCHEMA %>._cdb_entity_config() AS (u text, o text); + SELECT u, o INTO username, orgname FROM <%= DATASERVICES_CLIENT_SCHEMA %>._cdb_entity_config() AS (u text, o text); -- JSON value stored "" is taken as literal IF username IS NULL OR username = '' OR username = '""' THEN RAISE EXCEPTION 'Username is a mandatory argument, check it out'; END IF; - SELECT <%= GEOCODER_CLIENT_SCHEMA %>._<%= name %>(username, orgname, <%= params %>) INTO ret; + SELECT <%= DATASERVICES_CLIENT_SCHEMA %>._<%= name %>(username, orgname, <%= params %>) INTO ret; RETURN ret; END; $$ LANGUAGE 'plpgsql' SECURITY DEFINER; diff --git a/client/renderer/templates/30_plproxy_functions.erb b/client/renderer/templates/30_plproxy_functions.erb index 906d8a5..617547d 100644 --- a/client/renderer/templates/30_plproxy_functions.erb +++ b/client/renderer/templates/30_plproxy_functions.erb @@ -1,6 +1,6 @@ -CREATE OR REPLACE FUNCTION <%= GEOCODER_CLIENT_SCHEMA %>._<%= name %> (username text, organization_name text, <%= params_with_type_and_default %>) +CREATE OR REPLACE FUNCTION <%= DATASERVICES_CLIENT_SCHEMA %>._<%= name %> (username text, organization_name text, <%= params_with_type_and_default %>) RETURNS <%= return_type %> AS $$ - CONNECT <%= GEOCODER_CLIENT_SCHEMA %>._server_conn_str(); - SELECT cdb_geocoder_server.<%= name %> (username, organization_name, <%= params %>); + CONNECT <%= DATASERVICES_CLIENT_SCHEMA %>._server_conn_str(); + SELECT <%= DATASERVICES_SERVER_SCHEMA %>.<%= name %> (username, organization_name, <%= params %>); $$ LANGUAGE plproxy; diff --git a/client/renderer/templates/90_grant_execute.erb b/client/renderer/templates/90_grant_execute.erb index 97415ca..7d0c030 100644 --- a/client/renderer/templates/90_grant_execute.erb +++ b/client/renderer/templates/90_grant_execute.erb @@ -1 +1 @@ -GRANT EXECUTE ON FUNCTION <%= GEOCODER_CLIENT_SCHEMA %>.<%= name %>(<%= params_with_type %>) TO publicuser; \ No newline at end of file +GRANT EXECUTE ON FUNCTION <%= DATASERVICES_CLIENT_SCHEMA %>.<%= name %>(<%= params_with_type %>) TO publicuser; \ No newline at end of file diff --git a/client/sql/0.0.1/00_header.sql b/client/sql/0.0.1/00_header.sql index 1779c9f..65eb4bf 100644 --- a/client/sql/0.0.1/00_header.sql +++ b/client/sql/0.0.1/00_header.sql @@ -1,3 +1,3 @@ --DO NOT MODIFY THIS FILE, IT IS GENERATED AUTOMATICALLY FROM SOURCES -- Complain if script is sourced in psql, rather than via CREATE EXTENSION -\echo Use "CREATE EXTENSION cdb_geocoder_client" to load this file. \quit +\echo Use "CREATE EXTENSION cdb_dataservices_client" to load this file. \quit diff --git a/client/sql/0.0.1/10_geocoder_server_conn.sql b/client/sql/0.0.1/10_geocoder_server_conn.sql index 5f3e1fc..89cbcbd 100644 --- a/client/sql/0.0.1/10_geocoder_server_conn.sql +++ b/client/sql/0.0.1/10_geocoder_server_conn.sql @@ -4,7 +4,7 @@ -- The purpose of this function is provide to the PL/Proxy functions -- the connection string needed to connect with the server -CREATE OR REPLACE FUNCTION cdb_geocoder_client._server_conn_str() +CREATE OR REPLACE FUNCTION cdb_dataservices_client._server_conn_str() RETURNS text AS $$ DECLARE db_connection_str text; @@ -13,4 +13,4 @@ BEGIN SELECT trim(both '"' FROM db_connection_str) INTO db_connection_str; RETURN db_connection_str; END; -$$ LANGUAGE 'plpgsql'; \ No newline at end of file +$$ LANGUAGE 'plpgsql'; diff --git a/client/sql/0.0.1/15_config_management.sql b/client/sql/0.0.1/15_config_management.sql index 6ff3c8d..4d4187b 100644 --- a/client/sql/0.0.1/15_config_management.sql +++ b/client/sql/0.0.1/15_config_management.sql @@ -1,4 +1,4 @@ -CREATE TYPE cdb_geocoder_client._entity_config AS ( +CREATE TYPE cdb_dataservices_client._entity_config AS ( username text, organization_name text ); @@ -9,10 +9,10 @@ CREATE TYPE cdb_geocoder_client._entity_config AS ( -- The purpose of this function is to retrieve the username and organization name from -- a) schema where he/her is the owner in case is an organization user -- b) entity_name from the cdb_conf database in case is a non organization user -CREATE OR REPLACE FUNCTION cdb_geocoder_client._cdb_entity_config() +CREATE OR REPLACE FUNCTION cdb_dataservices_client._cdb_entity_config() RETURNS record AS $$ DECLARE - result cdb_geocoder_client._entity_config; + result cdb_dataservices_client._entity_config; is_organization boolean; username text; organization_name text; @@ -34,4 +34,4 @@ BEGIN result.organization_name = organization_name; RETURN result; END; -$$ LANGUAGE 'plpgsql' SECURITY DEFINER; \ No newline at end of file +$$ LANGUAGE 'plpgsql' SECURITY DEFINER; diff --git a/client/sql/0.0.1/80_permissions.sql b/client/sql/0.0.1/80_permissions.sql index 16fc021..4af1393 100644 --- a/client/sql/0.0.1/80_permissions.sql +++ b/client/sql/0.0.1/80_permissions.sql @@ -1,9 +1,9 @@ -- Make sure by default there are no permissions for publicuser -- NOTE: this happens at extension creation time, as part of an implicit transaction. -REVOKE ALL PRIVILEGES ON SCHEMA cdb_geocoder_client FROM PUBLIC, publicuser CASCADE; +REVOKE ALL PRIVILEGES ON SCHEMA cdb_dataservices_client FROM PUBLIC, publicuser CASCADE; -- Grant permissions on the schema to publicuser (but just the schema) -GRANT USAGE ON SCHEMA cdb_geocoder_client TO publicuser; +GRANT USAGE ON SCHEMA cdb_dataservices_client TO publicuser; -- Revoke execute permissions on all functions in the schema by default -REVOKE EXECUTE ON ALL FUNCTIONS IN SCHEMA cdb_geocoder_client FROM PUBLIC, publicuser; +REVOKE EXECUTE ON ALL FUNCTIONS IN SCHEMA cdb_dataservices_client FROM PUBLIC, publicuser; diff --git a/client/sql/0.1.0/00_header.sql b/client/sql/0.1.0/00_header.sql index 1779c9f..65eb4bf 100644 --- a/client/sql/0.1.0/00_header.sql +++ b/client/sql/0.1.0/00_header.sql @@ -1,3 +1,3 @@ --DO NOT MODIFY THIS FILE, IT IS GENERATED AUTOMATICALLY FROM SOURCES -- Complain if script is sourced in psql, rather than via CREATE EXTENSION -\echo Use "CREATE EXTENSION cdb_geocoder_client" to load this file. \quit +\echo Use "CREATE EXTENSION cdb_dataservices_client" to load this file. \quit diff --git a/client/sql/0.1.0/10_geocoder_server_conn.sql b/client/sql/0.1.0/10_geocoder_server_conn.sql index 5f3e1fc..89cbcbd 100644 --- a/client/sql/0.1.0/10_geocoder_server_conn.sql +++ b/client/sql/0.1.0/10_geocoder_server_conn.sql @@ -4,7 +4,7 @@ -- The purpose of this function is provide to the PL/Proxy functions -- the connection string needed to connect with the server -CREATE OR REPLACE FUNCTION cdb_geocoder_client._server_conn_str() +CREATE OR REPLACE FUNCTION cdb_dataservices_client._server_conn_str() RETURNS text AS $$ DECLARE db_connection_str text; @@ -13,4 +13,4 @@ BEGIN SELECT trim(both '"' FROM db_connection_str) INTO db_connection_str; RETURN db_connection_str; END; -$$ LANGUAGE 'plpgsql'; \ No newline at end of file +$$ LANGUAGE 'plpgsql'; diff --git a/client/sql/0.1.0/15_config_management.sql b/client/sql/0.1.0/15_config_management.sql index 34da860..7680cfd 100644 --- a/client/sql/0.1.0/15_config_management.sql +++ b/client/sql/0.1.0/15_config_management.sql @@ -1,4 +1,4 @@ -CREATE TYPE cdb_geocoder_client._entity_config AS ( +CREATE TYPE cdb_dataservices_client._entity_config AS ( username text, organization_name text ); @@ -9,10 +9,10 @@ CREATE TYPE cdb_geocoder_client._entity_config AS ( -- The purpose of this function is to retrieve the username and organization name from -- a) schema where he/her is the owner in case is an organization user -- b) entity_name from the cdb_conf database in case is a non organization user -CREATE OR REPLACE FUNCTION cdb_geocoder_client._cdb_entity_config() +CREATE OR REPLACE FUNCTION cdb_dataservices_client._cdb_entity_config() RETURNS record AS $$ DECLARE - result cdb_geocoder_client._entity_config; + result cdb_dataservices_client._entity_config; is_organization boolean; username text; organization_name text; @@ -34,4 +34,4 @@ BEGIN result.organization_name = organization_name; RETURN result; END; -$$ LANGUAGE 'plpgsql' SECURITY DEFINER; \ No newline at end of file +$$ LANGUAGE 'plpgsql' SECURITY DEFINER; diff --git a/client/sql/0.1.0/80_permissions.sql b/client/sql/0.1.0/80_permissions.sql index 16fc021..4af1393 100644 --- a/client/sql/0.1.0/80_permissions.sql +++ b/client/sql/0.1.0/80_permissions.sql @@ -1,9 +1,9 @@ -- Make sure by default there are no permissions for publicuser -- NOTE: this happens at extension creation time, as part of an implicit transaction. -REVOKE ALL PRIVILEGES ON SCHEMA cdb_geocoder_client FROM PUBLIC, publicuser CASCADE; +REVOKE ALL PRIVILEGES ON SCHEMA cdb_dataservices_client FROM PUBLIC, publicuser CASCADE; -- Grant permissions on the schema to publicuser (but just the schema) -GRANT USAGE ON SCHEMA cdb_geocoder_client TO publicuser; +GRANT USAGE ON SCHEMA cdb_dataservices_client TO publicuser; -- Revoke execute permissions on all functions in the schema by default -REVOKE EXECUTE ON ALL FUNCTIONS IN SCHEMA cdb_geocoder_client FROM PUBLIC, publicuser; +REVOKE EXECUTE ON ALL FUNCTIONS IN SCHEMA cdb_dataservices_client FROM PUBLIC, publicuser; diff --git a/client/test/0.0.1/expected/00_installation_test.out b/client/test/0.0.1/expected/00_installation_test.out index cbeef05..8c6f98d 100644 --- a/client/test/0.0.1/expected/00_installation_test.out +++ b/client/test/0.0.1/expected/00_installation_test.out @@ -5,7 +5,7 @@ CREATE EXTENSION plpythonu; CREATE EXTENSION cartodb; CREATE EXTENSION plproxy; -- Install the extension -CREATE EXTENSION cdb_geocoder_client; +CREATE EXTENSION cdb_dataservices_client; -- Mock the server connection to point to this very test db SELECT cartodb.cdb_conf_setconf('geocoder_server_config', '{"connection_str": "dbname=contrib_regression host=127.0.0.1 user=postgres"}'); cdb_conf_setconf @@ -21,9 +21,9 @@ SELECT cartodb.cdb_conf_setconf('user_config', '{"is_organization": false, "enti (1 row) -- Mock the server schema -CREATE SCHEMA cdb_geocoder_server; +CREATE SCHEMA cdb_dataservices_server; -- Create a test user to check permissions 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 public,cartodb,cdb_geocoder_client; +ALTER ROLE test_regular_user SET search_path TO public,cartodb,cdb_dataservices_client; diff --git a/client/test/0.0.1/expected/10_admin0_test.out b/client/test/0.0.1/expected/10_admin0_test.out index 63dfbe0..178584c 100644 --- a/client/test/0.0.1/expected/10_admin0_test.out +++ b/client/test/0.0.1/expected/10_admin0_test.out @@ -1,17 +1,17 @@ -- Add to the search path the schema -SET search_path TO public,cartodb,cdb_geocoder_client; +SET search_path TO public,cartodb,cdb_dataservices_client; -- Mock the server function -CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_admin0_polygon(username text, orgname text, country_name text) +CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_admin0_polygon(username text, orgname text, country_name text) RETURNS Geometry AS $$ BEGIN - RAISE NOTICE 'cdb_geocoder_server.cdb_geocode_admin0_polygon invoked with params (%, %, %)', username, orgname, country_name; + RAISE NOTICE 'cdb_dataservices_server.cdb_geocode_admin0_polygon invoked with params (%, %, %)', username, orgname, country_name; RETURN NULL; END; $$ LANGUAGE 'plpgsql'; -- Exercise the public and the proxied function SELECT cdb_geocode_admin0_polygon('Spain'); -NOTICE: cdb_geocoder_client._cdb_geocode_admin0_polygon(3): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_admin0_polygon invoked with params ("test_user", , Spain) -CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_admin0_polygon(username, orgname, country_name)" +NOTICE: cdb_dataservices_client._cdb_geocode_admin0_polygon(3): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_admin0_polygon invoked with params ("test_user", , Spain) +CONTEXT: SQL statement "SELECT cdb_dataservices_client._cdb_geocode_admin0_polygon(username, orgname, country_name)" PL/pgSQL function cdb_geocode_admin0_polygon(text) line 15 at SQL statement cdb_geocode_admin0_polygon ---------------------------- diff --git a/client/test/0.0.1/expected/20_admin1_test.out b/client/test/0.0.1/expected/20_admin1_test.out index 3d5d055..647643b 100644 --- a/client/test/0.0.1/expected/20_admin1_test.out +++ b/client/test/0.0.1/expected/20_admin1_test.out @@ -1,24 +1,24 @@ -- Add to the search path the schema -SET search_path TO public,cartodb,cdb_geocoder_client; +SET search_path TO public,cartodb,cdb_dataservices_client; -- Mock the server functions -CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_admin1_polygon(username text, orgname text, admin1_name text) +CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_admin1_polygon(username text, orgname text, admin1_name text) RETURNS Geometry AS $$ BEGIN - RAISE NOTICE 'cdb_geocoder_server.cdb_geocode_admin1_polygon invoked with params (%, %, %)', username, orgname, admin1_name; + RAISE NOTICE 'cdb_dataservices_server.cdb_geocode_admin1_polygon invoked with params (%, %, %)', username, orgname, admin1_name; RETURN NULL; END; $$ LANGUAGE 'plpgsql'; -CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_admin1_polygon(username text, orgname text, admin1_name text, country_name text) +CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_admin1_polygon(username text, orgname text, admin1_name text, country_name text) RETURNS Geometry AS $$ BEGIN - RAISE NOTICE 'cdb_geocoder_server.cdb_geocode_admin1_polygon invoked with params (%, %, %, %)', username, orgname, admin1_name, country_name; + RAISE NOTICE 'cdb_dataservices_server.cdb_geocode_admin1_polygon invoked with params (%, %, %, %)', username, orgname, admin1_name, country_name; RETURN NULL; END; $$ LANGUAGE 'plpgsql'; -- Exercise the public and the proxied function SELECT cdb_geocode_admin1_polygon('California'); -NOTICE: cdb_geocoder_client._cdb_geocode_admin1_polygon(3): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_admin1_polygon invoked with params ("test_user", , California) -CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_admin1_polygon(username, orgname, admin1_name)" +NOTICE: cdb_dataservices_client._cdb_geocode_admin1_polygon(3): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_admin1_polygon invoked with params ("test_user", , California) +CONTEXT: SQL statement "SELECT cdb_dataservices_client._cdb_geocode_admin1_polygon(username, orgname, admin1_name)" PL/pgSQL function cdb_geocode_admin1_polygon(text) line 15 at SQL statement cdb_geocode_admin1_polygon ---------------------------- @@ -26,8 +26,8 @@ PL/pgSQL function cdb_geocode_admin1_polygon(text) line 15 at SQL statement (1 row) SELECT cdb_geocode_admin1_polygon('California', 'United States'); -NOTICE: cdb_geocoder_client._cdb_geocode_admin1_polygon(4): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_admin1_polygon invoked with params ("test_user", , California, United States) -CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_admin1_polygon(username, orgname, admin1_name, country_name)" +NOTICE: cdb_dataservices_client._cdb_geocode_admin1_polygon(4): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_admin1_polygon invoked with params ("test_user", , California, United States) +CONTEXT: SQL statement "SELECT cdb_dataservices_client._cdb_geocode_admin1_polygon(username, orgname, admin1_name, country_name)" PL/pgSQL function cdb_geocode_admin1_polygon(text,text) line 15 at SQL statement cdb_geocode_admin1_polygon ---------------------------- diff --git a/client/test/0.0.1/expected/30_namedplaces_test.out b/client/test/0.0.1/expected/30_namedplaces_test.out index 3ca1a77..b04faf2 100644 --- a/client/test/0.0.1/expected/30_namedplaces_test.out +++ b/client/test/0.0.1/expected/30_namedplaces_test.out @@ -1,31 +1,31 @@ -- Add to the search path the schema -SET search_path TO public,cartodb,cdb_geocoder_client; +SET search_path TO public,cartodb,cdb_dataservices_client; -- Mock the server functions -CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text) +CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text) RETURNS Geometry AS $$ BEGIN - RAISE NOTICE 'cdb_geocoder_server.cdb_geocode_namedplace_point invoked with params (%, %, %)', username, orgname, city_name; + RAISE NOTICE 'cdb_dataservices_server.cdb_geocode_namedplace_point invoked with params (%, %, %)', username, orgname, city_name; RETURN NULL; END; $$ LANGUAGE 'plpgsql'; -CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, country_name text) +CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, country_name text) RETURNS Geometry AS $$ BEGIN - RAISE NOTICE 'cdb_geocoder_server.cdb_geocode_namedplace_point invoked with params (%, %, %, %)', username, orgname, city_name, country_name; + RAISE NOTICE 'cdb_dataservices_server.cdb_geocode_namedplace_point invoked with params (%, %, %, %)', username, orgname, city_name, country_name; RETURN NULL; END; $$ LANGUAGE 'plpgsql'; -CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, admin1_name text, country_name text) +CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, admin1_name text, country_name text) RETURNS Geometry AS $$ BEGIN - RAISE NOTICE 'cdb_geocoder_server.cdb_geocode_namedplace_point invoked with params (%, %, %, %, %)', username, orgname, city_name, admin1_name, country_name; + RAISE NOTICE 'cdb_dataservices_server.cdb_geocode_namedplace_point invoked with params (%, %, %, %, %)', username, orgname, city_name, admin1_name, country_name; RETURN NULL; END; $$ LANGUAGE 'plpgsql'; -- Exercise the public and the proxied function SELECT cdb_geocode_namedplace_point('Elx'); -NOTICE: cdb_geocoder_client._cdb_geocode_namedplace_point(3): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_namedplace_point invoked with params ("test_user", , Elx) -CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_namedplace_point(username, orgname, city_name)" +NOTICE: cdb_dataservices_client._cdb_geocode_namedplace_point(3): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_namedplace_point invoked with params ("test_user", , Elx) +CONTEXT: SQL statement "SELECT cdb_dataservices_client._cdb_geocode_namedplace_point(username, orgname, city_name)" PL/pgSQL function cdb_geocode_namedplace_point(text) line 15 at SQL statement cdb_geocode_namedplace_point ------------------------------ @@ -33,8 +33,8 @@ PL/pgSQL function cdb_geocode_namedplace_point(text) line 15 at SQL statement (1 row) SELECT cdb_geocode_namedplace_point('Elx', 'Spain'); -NOTICE: cdb_geocoder_client._cdb_geocode_namedplace_point(4): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_namedplace_point invoked with params ("test_user", , Elx, Spain) -CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_namedplace_point(username, orgname, city_name, country_name)" +NOTICE: cdb_dataservices_client._cdb_geocode_namedplace_point(4): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_namedplace_point invoked with params ("test_user", , Elx, Spain) +CONTEXT: SQL statement "SELECT cdb_dataservices_client._cdb_geocode_namedplace_point(username, orgname, city_name, country_name)" PL/pgSQL function cdb_geocode_namedplace_point(text,text) line 15 at SQL statement cdb_geocode_namedplace_point ------------------------------ @@ -42,8 +42,8 @@ PL/pgSQL function cdb_geocode_namedplace_point(text,text) line 15 at SQL stateme (1 row) SELECT cdb_geocode_namedplace_point('Elx', 'Valencia', 'Spain'); -NOTICE: cdb_geocoder_client._cdb_geocode_namedplace_point(5): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_namedplace_point invoked with params ("test_user", , Elx, Valencia, Spain) -CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_namedplace_point(username, orgname, city_name, admin1_name, country_name)" +NOTICE: cdb_dataservices_client._cdb_geocode_namedplace_point(5): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_namedplace_point invoked with params ("test_user", , Elx, Valencia, Spain) +CONTEXT: SQL statement "SELECT cdb_dataservices_client._cdb_geocode_namedplace_point(username, orgname, city_name, admin1_name, country_name)" PL/pgSQL function cdb_geocode_namedplace_point(text,text,text) line 15 at SQL statement cdb_geocode_namedplace_point ------------------------------ diff --git a/client/test/0.0.1/expected/40_postalcodes_test.out b/client/test/0.0.1/expected/40_postalcodes_test.out index 1415fdd..a5a1d73 100644 --- a/client/test/0.0.1/expected/40_postalcodes_test.out +++ b/client/test/0.0.1/expected/40_postalcodes_test.out @@ -1,24 +1,24 @@ -- Add to the search path the schema -SET search_path TO public,cartodb,cdb_geocoder_client; +SET search_path TO public,cartodb,cdb_dataservices_client; -- Mock the server functions -CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_postalcode_polygon(username text, orgname text, postal_code text, country_name text) +CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_polygon(username text, orgname text, postal_code text, country_name text) RETURNS Geometry AS $$ BEGIN - RAISE NOTICE 'cdb_geocoder_server.cdb_geocode_postalcode_polygon invoked with params (%, %, %, %)', username, orgname, postal_code, country_name; + RAISE NOTICE 'cdb_dataservices_server.cdb_geocode_postalcode_polygon invoked with params (%, %, %, %)', username, orgname, postal_code, country_name; RETURN NULL; END; $$ LANGUAGE 'plpgsql'; -CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_postalcode_point(username text, orgname text, postal_code text, country_name text) +CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_point(username text, orgname text, postal_code text, country_name text) RETURNS Geometry AS $$ BEGIN - RAISE NOTICE 'cdb_geocoder_server.cdb_geocode_postalcode_point invoked with params (%, %, %, %)', username, orgname, postal_code, country_name; + RAISE NOTICE 'cdb_dataservices_server.cdb_geocode_postalcode_point invoked with params (%, %, %, %)', username, orgname, postal_code, country_name; RETURN NULL; END; $$ LANGUAGE 'plpgsql'; -- Exercise the public and the proxied function SELECT cdb_geocode_postalcode_polygon('03204', 'Spain'); -NOTICE: cdb_geocoder_client._cdb_geocode_postalcode_polygon(4): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_postalcode_polygon invoked with params ("test_user", , 03204, Spain) -CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_postalcode_polygon(username, orgname, postal_code, country_name)" +NOTICE: cdb_dataservices_client._cdb_geocode_postalcode_polygon(4): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_postalcode_polygon invoked with params ("test_user", , 03204, Spain) +CONTEXT: SQL statement "SELECT cdb_dataservices_client._cdb_geocode_postalcode_polygon(username, orgname, postal_code, country_name)" PL/pgSQL function cdb_geocode_postalcode_polygon(text,text) line 15 at SQL statement cdb_geocode_postalcode_polygon -------------------------------- @@ -26,8 +26,8 @@ PL/pgSQL function cdb_geocode_postalcode_polygon(text,text) line 15 at SQL state (1 row) SELECT cdb_geocode_postalcode_point('03204', 'Spain'); -NOTICE: cdb_geocoder_client._cdb_geocode_postalcode_point(4): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_postalcode_point invoked with params ("test_user", , 03204, Spain) -CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_postalcode_point(username, orgname, postal_code, country_name)" +NOTICE: cdb_dataservices_client._cdb_geocode_postalcode_point(4): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_postalcode_point invoked with params ("test_user", , 03204, Spain) +CONTEXT: SQL statement "SELECT cdb_dataservices_client._cdb_geocode_postalcode_point(username, orgname, postal_code, country_name)" PL/pgSQL function cdb_geocode_postalcode_point(text,text) line 15 at SQL statement cdb_geocode_postalcode_point ------------------------------ diff --git a/client/test/0.0.1/expected/50_ipaddresses_test.out b/client/test/0.0.1/expected/50_ipaddresses_test.out index 624712d..ad8cb8a 100644 --- a/client/test/0.0.1/expected/50_ipaddresses_test.out +++ b/client/test/0.0.1/expected/50_ipaddresses_test.out @@ -1,17 +1,17 @@ -- Add to the search path the schema -SET search_path TO public,cartodb,cdb_geocoder_client; +SET search_path TO public,cartodb,cdb_dataservices_client; -- Mock the server functions -CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_ipaddress_point(username text, orgname text, ip_address text) +CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_ipaddress_point(username text, orgname text, ip_address text) RETURNS Geometry AS $$ BEGIN - RAISE NOTICE 'cdb_geocoder_server.cdb_geocode_ipaddress_point invoked with params (%, %, %)', username, orgname, ip_address; + RAISE NOTICE 'cdb_dataservices_server.cdb_geocode_ipaddress_point invoked with params (%, %, %)', username, orgname, ip_address; RETURN NULL; END; $$ LANGUAGE 'plpgsql'; -- Exercise the public and the proxied function SELECT cdb_geocode_ipaddress_point('8.8.8.8'); -NOTICE: cdb_geocoder_client._cdb_geocode_ipaddress_point(3): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_ipaddress_point invoked with params ("test_user", , 8.8.8.8) -CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_ipaddress_point(username, orgname, ip_address)" +NOTICE: cdb_dataservices_client._cdb_geocode_ipaddress_point(3): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_ipaddress_point invoked with params ("test_user", , 8.8.8.8) +CONTEXT: SQL statement "SELECT cdb_dataservices_client._cdb_geocode_ipaddress_point(username, orgname, ip_address)" PL/pgSQL function cdb_geocode_ipaddress_point(text) line 15 at SQL statement cdb_geocode_ipaddress_point ----------------------------- diff --git a/client/test/0.0.1/expected/90_permissions_test.out b/client/test/0.0.1/expected/90_permissions_test.out index 99def95..3ed5347 100644 --- a/client/test/0.0.1/expected/90_permissions_test.out +++ b/client/test/0.0.1/expected/90_permissions_test.out @@ -1,12 +1,12 @@ -- Use regular user role SET ROLE test_regular_user; -- Add to the search path the schema -SET search_path TO public,cartodb,cdb_geocoder_client; +SET search_path TO public,cartodb,cdb_dataservices_client; -- Exercise the public function -- it is public, it shall work SELECT cdb_geocode_admin0_polygon('Spain'); -NOTICE: cdb_geocoder_client._cdb_geocode_admin0_polygon(3): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_admin0_polygon invoked with params ("test_user", , Spain) -CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_admin0_polygon(username, orgname, country_name)" +NOTICE: cdb_dataservices_client._cdb_geocode_admin0_polygon(3): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_admin0_polygon invoked with params ("test_user", , Spain) +CONTEXT: SQL statement "SELECT cdb_dataservices_client._cdb_geocode_admin0_polygon(username, orgname, country_name)" PL/pgSQL function cdb_geocode_admin0_polygon(text) line 15 at SQL statement cdb_geocode_admin0_polygon ---------------------------- @@ -14,8 +14,8 @@ PL/pgSQL function cdb_geocode_admin0_polygon(text) line 15 at SQL statement (1 row) SELECT cdb_geocode_admin1_polygon('California'); -NOTICE: cdb_geocoder_client._cdb_geocode_admin1_polygon(3): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_admin1_polygon invoked with params ("test_user", , California) -CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_admin1_polygon(username, orgname, admin1_name)" +NOTICE: cdb_dataservices_client._cdb_geocode_admin1_polygon(3): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_admin1_polygon invoked with params ("test_user", , California) +CONTEXT: SQL statement "SELECT cdb_dataservices_client._cdb_geocode_admin1_polygon(username, orgname, admin1_name)" PL/pgSQL function cdb_geocode_admin1_polygon(text) line 15 at SQL statement cdb_geocode_admin1_polygon ---------------------------- @@ -23,8 +23,8 @@ PL/pgSQL function cdb_geocode_admin1_polygon(text) line 15 at SQL statement (1 row) SELECT cdb_geocode_admin1_polygon('California', 'United States'); -NOTICE: cdb_geocoder_client._cdb_geocode_admin1_polygon(4): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_admin1_polygon invoked with params ("test_user", , California, United States) -CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_admin1_polygon(username, orgname, admin1_name, country_name)" +NOTICE: cdb_dataservices_client._cdb_geocode_admin1_polygon(4): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_admin1_polygon invoked with params ("test_user", , California, United States) +CONTEXT: SQL statement "SELECT cdb_dataservices_client._cdb_geocode_admin1_polygon(username, orgname, admin1_name, country_name)" PL/pgSQL function cdb_geocode_admin1_polygon(text,text) line 15 at SQL statement cdb_geocode_admin1_polygon ---------------------------- @@ -32,8 +32,8 @@ PL/pgSQL function cdb_geocode_admin1_polygon(text,text) line 15 at SQL statement (1 row) SELECT cdb_geocode_namedplace_point('Elx'); -NOTICE: cdb_geocoder_client._cdb_geocode_namedplace_point(3): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_namedplace_point invoked with params ("test_user", , Elx) -CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_namedplace_point(username, orgname, city_name)" +NOTICE: cdb_dataservices_client._cdb_geocode_namedplace_point(3): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_namedplace_point invoked with params ("test_user", , Elx) +CONTEXT: SQL statement "SELECT cdb_dataservices_client._cdb_geocode_namedplace_point(username, orgname, city_name)" PL/pgSQL function cdb_geocode_namedplace_point(text) line 15 at SQL statement cdb_geocode_namedplace_point ------------------------------ @@ -41,8 +41,8 @@ PL/pgSQL function cdb_geocode_namedplace_point(text) line 15 at SQL statement (1 row) SELECT cdb_geocode_namedplace_point('Elx', 'Valencia'); -NOTICE: cdb_geocoder_client._cdb_geocode_namedplace_point(4): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_namedplace_point invoked with params ("test_user", , Elx, Valencia) -CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_namedplace_point(username, orgname, city_name, country_name)" +NOTICE: cdb_dataservices_client._cdb_geocode_namedplace_point(4): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_namedplace_point invoked with params ("test_user", , Elx, Valencia) +CONTEXT: SQL statement "SELECT cdb_dataservices_client._cdb_geocode_namedplace_point(username, orgname, city_name, country_name)" PL/pgSQL function cdb_geocode_namedplace_point(text,text) line 15 at SQL statement cdb_geocode_namedplace_point ------------------------------ @@ -50,8 +50,8 @@ PL/pgSQL function cdb_geocode_namedplace_point(text,text) line 15 at SQL stateme (1 row) SELECT cdb_geocode_namedplace_point('Elx', 'Valencia', 'Spain'); -NOTICE: cdb_geocoder_client._cdb_geocode_namedplace_point(5): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_namedplace_point invoked with params ("test_user", , Elx, Valencia, Spain) -CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_namedplace_point(username, orgname, city_name, admin1_name, country_name)" +NOTICE: cdb_dataservices_client._cdb_geocode_namedplace_point(5): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_namedplace_point invoked with params ("test_user", , Elx, Valencia, Spain) +CONTEXT: SQL statement "SELECT cdb_dataservices_client._cdb_geocode_namedplace_point(username, orgname, city_name, admin1_name, country_name)" PL/pgSQL function cdb_geocode_namedplace_point(text,text,text) line 15 at SQL statement cdb_geocode_namedplace_point ------------------------------ @@ -59,8 +59,8 @@ PL/pgSQL function cdb_geocode_namedplace_point(text,text,text) line 15 at SQL st (1 row) SELECT cdb_geocode_postalcode_polygon('03204', 'Spain'); -NOTICE: cdb_geocoder_client._cdb_geocode_postalcode_polygon(4): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_postalcode_polygon invoked with params ("test_user", , 03204, Spain) -CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_postalcode_polygon(username, orgname, postal_code, country_name)" +NOTICE: cdb_dataservices_client._cdb_geocode_postalcode_polygon(4): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_postalcode_polygon invoked with params ("test_user", , 03204, Spain) +CONTEXT: SQL statement "SELECT cdb_dataservices_client._cdb_geocode_postalcode_polygon(username, orgname, postal_code, country_name)" PL/pgSQL function cdb_geocode_postalcode_polygon(text,text) line 15 at SQL statement cdb_geocode_postalcode_polygon -------------------------------- @@ -68,8 +68,8 @@ PL/pgSQL function cdb_geocode_postalcode_polygon(text,text) line 15 at SQL state (1 row) SELECT cdb_geocode_postalcode_point('03204', 'Spain'); -NOTICE: cdb_geocoder_client._cdb_geocode_postalcode_point(4): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_postalcode_point invoked with params ("test_user", , 03204, Spain) -CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_postalcode_point(username, orgname, postal_code, country_name)" +NOTICE: cdb_dataservices_client._cdb_geocode_postalcode_point(4): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_postalcode_point invoked with params ("test_user", , 03204, Spain) +CONTEXT: SQL statement "SELECT cdb_dataservices_client._cdb_geocode_postalcode_point(username, orgname, postal_code, country_name)" PL/pgSQL function cdb_geocode_postalcode_point(text,text) line 15 at SQL statement cdb_geocode_postalcode_point ------------------------------ @@ -77,8 +77,8 @@ PL/pgSQL function cdb_geocode_postalcode_point(text,text) line 15 at SQL stateme (1 row) SELECT cdb_geocode_ipaddress_point('8.8.8.8'); -NOTICE: cdb_geocoder_client._cdb_geocode_ipaddress_point(3): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_ipaddress_point invoked with params ("test_user", , 8.8.8.8) -CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_ipaddress_point(username, orgname, ip_address)" +NOTICE: cdb_dataservices_client._cdb_geocode_ipaddress_point(3): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_ipaddress_point invoked with params ("test_user", , 8.8.8.8) +CONTEXT: SQL statement "SELECT cdb_dataservices_client._cdb_geocode_ipaddress_point(username, orgname, ip_address)" PL/pgSQL function cdb_geocode_ipaddress_point(text) line 15 at SQL statement cdb_geocode_ipaddress_point ----------------------------- diff --git a/client/test/0.0.1/sql/00_installation_test.sql b/client/test/0.0.1/sql/00_installation_test.sql index 784fa03..fc3395f 100644 --- a/client/test/0.0.1/sql/00_installation_test.sql +++ b/client/test/0.0.1/sql/00_installation_test.sql @@ -6,7 +6,7 @@ CREATE EXTENSION cartodb; CREATE EXTENSION plproxy; -- Install the extension -CREATE EXTENSION cdb_geocoder_client; +CREATE EXTENSION cdb_dataservices_client; -- Mock the server connection to point to this very test db SELECT cartodb.cdb_conf_setconf('geocoder_server_config', '{"connection_str": "dbname=contrib_regression host=127.0.0.1 user=postgres"}'); @@ -14,10 +14,10 @@ SELECT cartodb.cdb_conf_setconf('geocoder_server_config', '{"connection_str": "d SELECT cartodb.cdb_conf_setconf('user_config', '{"is_organization": false, "entity_name": "test_user"}'); -- Mock the server schema -CREATE SCHEMA cdb_geocoder_server; +CREATE SCHEMA cdb_dataservices_server; -- Create a test user to check permissions 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 public,cartodb,cdb_geocoder_client; \ No newline at end of file +ALTER ROLE test_regular_user SET search_path TO public,cartodb,cdb_dataservices_client; diff --git a/client/test/0.0.1/sql/10_admin0_test.sql b/client/test/0.0.1/sql/10_admin0_test.sql index 5c3e488..e6750f1 100644 --- a/client/test/0.0.1/sql/10_admin0_test.sql +++ b/client/test/0.0.1/sql/10_admin0_test.sql @@ -1,11 +1,11 @@ -- Add to the search path the schema -SET search_path TO public,cartodb,cdb_geocoder_client; +SET search_path TO public,cartodb,cdb_dataservices_client; -- Mock the server function -CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_admin0_polygon(username text, orgname text, country_name text) +CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_admin0_polygon(username text, orgname text, country_name text) RETURNS Geometry AS $$ BEGIN - RAISE NOTICE 'cdb_geocoder_server.cdb_geocode_admin0_polygon invoked with params (%, %, %)', username, orgname, country_name; + RAISE NOTICE 'cdb_dataservices_server.cdb_geocode_admin0_polygon invoked with params (%, %, %)', username, orgname, country_name; RETURN NULL; END; $$ LANGUAGE 'plpgsql'; diff --git a/client/test/0.0.1/sql/20_admin1_test.sql b/client/test/0.0.1/sql/20_admin1_test.sql index a8a2075..ecd2275 100644 --- a/client/test/0.0.1/sql/20_admin1_test.sql +++ b/client/test/0.0.1/sql/20_admin1_test.sql @@ -1,19 +1,19 @@ -- Add to the search path the schema -SET search_path TO public,cartodb,cdb_geocoder_client; +SET search_path TO public,cartodb,cdb_dataservices_client; -- Mock the server functions -CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_admin1_polygon(username text, orgname text, admin1_name text) +CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_admin1_polygon(username text, orgname text, admin1_name text) RETURNS Geometry AS $$ BEGIN - RAISE NOTICE 'cdb_geocoder_server.cdb_geocode_admin1_polygon invoked with params (%, %, %)', username, orgname, admin1_name; + RAISE NOTICE 'cdb_dataservices_server.cdb_geocode_admin1_polygon invoked with params (%, %, %)', username, orgname, admin1_name; RETURN NULL; END; $$ LANGUAGE 'plpgsql'; -CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_admin1_polygon(username text, orgname text, admin1_name text, country_name text) +CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_admin1_polygon(username text, orgname text, admin1_name text, country_name text) RETURNS Geometry AS $$ BEGIN - RAISE NOTICE 'cdb_geocoder_server.cdb_geocode_admin1_polygon invoked with params (%, %, %, %)', username, orgname, admin1_name, country_name; + RAISE NOTICE 'cdb_dataservices_server.cdb_geocode_admin1_polygon invoked with params (%, %, %, %)', username, orgname, admin1_name, country_name; RETURN NULL; END; $$ LANGUAGE 'plpgsql'; diff --git a/client/test/0.0.1/sql/30_namedplaces_test.sql b/client/test/0.0.1/sql/30_namedplaces_test.sql index 3309cf5..bdfba65 100644 --- a/client/test/0.0.1/sql/30_namedplaces_test.sql +++ b/client/test/0.0.1/sql/30_namedplaces_test.sql @@ -1,27 +1,27 @@ -- Add to the search path the schema -SET search_path TO public,cartodb,cdb_geocoder_client; +SET search_path TO public,cartodb,cdb_dataservices_client; -- Mock the server functions -CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text) +CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text) RETURNS Geometry AS $$ BEGIN - RAISE NOTICE 'cdb_geocoder_server.cdb_geocode_namedplace_point invoked with params (%, %, %)', username, orgname, city_name; + RAISE NOTICE 'cdb_dataservices_server.cdb_geocode_namedplace_point invoked with params (%, %, %)', username, orgname, city_name; RETURN NULL; END; $$ LANGUAGE 'plpgsql'; -CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, country_name text) +CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, country_name text) RETURNS Geometry AS $$ BEGIN - RAISE NOTICE 'cdb_geocoder_server.cdb_geocode_namedplace_point invoked with params (%, %, %, %)', username, orgname, city_name, country_name; + RAISE NOTICE 'cdb_dataservices_server.cdb_geocode_namedplace_point invoked with params (%, %, %, %)', username, orgname, city_name, country_name; RETURN NULL; END; $$ LANGUAGE 'plpgsql'; -CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, admin1_name text, country_name text) +CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, admin1_name text, country_name text) RETURNS Geometry AS $$ BEGIN - RAISE NOTICE 'cdb_geocoder_server.cdb_geocode_namedplace_point invoked with params (%, %, %, %, %)', username, orgname, city_name, admin1_name, country_name; + RAISE NOTICE 'cdb_dataservices_server.cdb_geocode_namedplace_point invoked with params (%, %, %, %, %)', username, orgname, city_name, admin1_name, country_name; RETURN NULL; END; $$ LANGUAGE 'plpgsql'; diff --git a/client/test/0.0.1/sql/40_postalcodes_test.sql b/client/test/0.0.1/sql/40_postalcodes_test.sql index b5aafc6..c1c2191 100644 --- a/client/test/0.0.1/sql/40_postalcodes_test.sql +++ b/client/test/0.0.1/sql/40_postalcodes_test.sql @@ -1,19 +1,19 @@ -- Add to the search path the schema -SET search_path TO public,cartodb,cdb_geocoder_client; +SET search_path TO public,cartodb,cdb_dataservices_client; -- Mock the server functions -CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_postalcode_polygon(username text, orgname text, postal_code text, country_name text) +CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_polygon(username text, orgname text, postal_code text, country_name text) RETURNS Geometry AS $$ BEGIN - RAISE NOTICE 'cdb_geocoder_server.cdb_geocode_postalcode_polygon invoked with params (%, %, %, %)', username, orgname, postal_code, country_name; + RAISE NOTICE 'cdb_dataservices_server.cdb_geocode_postalcode_polygon invoked with params (%, %, %, %)', username, orgname, postal_code, country_name; RETURN NULL; END; $$ LANGUAGE 'plpgsql'; -CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_postalcode_point(username text, orgname text, postal_code text, country_name text) +CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_point(username text, orgname text, postal_code text, country_name text) RETURNS Geometry AS $$ BEGIN - RAISE NOTICE 'cdb_geocoder_server.cdb_geocode_postalcode_point invoked with params (%, %, %, %)', username, orgname, postal_code, country_name; + RAISE NOTICE 'cdb_dataservices_server.cdb_geocode_postalcode_point invoked with params (%, %, %, %)', username, orgname, postal_code, country_name; RETURN NULL; END; $$ LANGUAGE 'plpgsql'; diff --git a/client/test/0.0.1/sql/50_ipaddresses_test.sql b/client/test/0.0.1/sql/50_ipaddresses_test.sql index 09a3342..c1fd8f7 100644 --- a/client/test/0.0.1/sql/50_ipaddresses_test.sql +++ b/client/test/0.0.1/sql/50_ipaddresses_test.sql @@ -1,11 +1,11 @@ -- Add to the search path the schema -SET search_path TO public,cartodb,cdb_geocoder_client; +SET search_path TO public,cartodb,cdb_dataservices_client; -- Mock the server functions -CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_ipaddress_point(username text, orgname text, ip_address text) +CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_ipaddress_point(username text, orgname text, ip_address text) RETURNS Geometry AS $$ BEGIN - RAISE NOTICE 'cdb_geocoder_server.cdb_geocode_ipaddress_point invoked with params (%, %, %)', username, orgname, ip_address; + RAISE NOTICE 'cdb_dataservices_server.cdb_geocode_ipaddress_point invoked with params (%, %, %)', username, orgname, ip_address; RETURN NULL; END; $$ LANGUAGE 'plpgsql'; diff --git a/client/test/0.0.1/sql/90_permissions_test.sql b/client/test/0.0.1/sql/90_permissions_test.sql index d33ab6c..7fbd2a0 100644 --- a/client/test/0.0.1/sql/90_permissions_test.sql +++ b/client/test/0.0.1/sql/90_permissions_test.sql @@ -2,7 +2,7 @@ SET ROLE test_regular_user; -- Add to the search path the schema -SET search_path TO public,cartodb,cdb_geocoder_client; +SET search_path TO public,cartodb,cdb_dataservices_client; -- Exercise the public function -- it is public, it shall work diff --git a/client/test/0.1.0/expected/00_installation_test.out b/client/test/0.1.0/expected/00_installation_test.out index cbeef05..8c6f98d 100644 --- a/client/test/0.1.0/expected/00_installation_test.out +++ b/client/test/0.1.0/expected/00_installation_test.out @@ -5,7 +5,7 @@ CREATE EXTENSION plpythonu; CREATE EXTENSION cartodb; CREATE EXTENSION plproxy; -- Install the extension -CREATE EXTENSION cdb_geocoder_client; +CREATE EXTENSION cdb_dataservices_client; -- Mock the server connection to point to this very test db SELECT cartodb.cdb_conf_setconf('geocoder_server_config', '{"connection_str": "dbname=contrib_regression host=127.0.0.1 user=postgres"}'); cdb_conf_setconf @@ -21,9 +21,9 @@ SELECT cartodb.cdb_conf_setconf('user_config', '{"is_organization": false, "enti (1 row) -- Mock the server schema -CREATE SCHEMA cdb_geocoder_server; +CREATE SCHEMA cdb_dataservices_server; -- Create a test user to check permissions 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 public,cartodb,cdb_geocoder_client; +ALTER ROLE test_regular_user SET search_path TO public,cartodb,cdb_dataservices_client; diff --git a/client/test/0.1.0/expected/10_admin0_test.out b/client/test/0.1.0/expected/10_admin0_test.out index 46d0b3f..98fa0db 100644 --- a/client/test/0.1.0/expected/10_admin0_test.out +++ b/client/test/0.1.0/expected/10_admin0_test.out @@ -1,17 +1,17 @@ -- Add to the search path the schema -SET search_path TO public,cartodb,cdb_geocoder_client; +SET search_path TO public,cartodb,cdb_dataservices_client; -- Mock the server function -CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_admin0_polygon(username text, orgname text, country_name text) +CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_admin0_polygon(username text, orgname text, country_name text) RETURNS Geometry AS $$ BEGIN - RAISE NOTICE 'cdb_geocoder_server.cdb_geocode_admin0_polygon invoked with params (%, %, %)', username, orgname, country_name; + RAISE NOTICE 'cdb_dataservices_server.cdb_geocode_admin0_polygon invoked with params (%, %, %)', username, orgname, country_name; RETURN NULL; END; $$ LANGUAGE 'plpgsql'; -- Exercise the public and the proxied function SELECT cdb_geocode_admin0_polygon('Spain'); -NOTICE: cdb_geocoder_client._cdb_geocode_admin0_polygon(3): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_admin0_polygon invoked with params (test_user, , Spain) -CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_admin0_polygon(username, orgname, country_name)" +NOTICE: cdb_dataservices_client._cdb_geocode_admin0_polygon(3): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_admin0_polygon invoked with params (test_user, , Spain) +CONTEXT: SQL statement "SELECT cdb_dataservices_client._cdb_geocode_admin0_polygon(username, orgname, country_name)" PL/pgSQL function cdb_geocode_admin0_polygon(text) line 15 at SQL statement cdb_geocode_admin0_polygon ---------------------------- diff --git a/client/test/0.1.0/expected/20_admin1_test.out b/client/test/0.1.0/expected/20_admin1_test.out index 2b859c3..36486b5 100644 --- a/client/test/0.1.0/expected/20_admin1_test.out +++ b/client/test/0.1.0/expected/20_admin1_test.out @@ -1,24 +1,24 @@ -- Add to the search path the schema -SET search_path TO public,cartodb,cdb_geocoder_client; +SET search_path TO public,cartodb,cdb_dataservices_client; -- Mock the server functions -CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_admin1_polygon(username text, orgname text, admin1_name text) +CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_admin1_polygon(username text, orgname text, admin1_name text) RETURNS Geometry AS $$ BEGIN - RAISE NOTICE 'cdb_geocoder_server.cdb_geocode_admin1_polygon invoked with params (%, %, %)', username, orgname, admin1_name; + RAISE NOTICE 'cdb_dataservices_server.cdb_geocode_admin1_polygon invoked with params (%, %, %)', username, orgname, admin1_name; RETURN NULL; END; $$ LANGUAGE 'plpgsql'; -CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_admin1_polygon(username text, orgname text, admin1_name text, country_name text) +CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_admin1_polygon(username text, orgname text, admin1_name text, country_name text) RETURNS Geometry AS $$ BEGIN - RAISE NOTICE 'cdb_geocoder_server.cdb_geocode_admin1_polygon invoked with params (%, %, %, %)', username, orgname, admin1_name, country_name; + RAISE NOTICE 'cdb_dataservices_server.cdb_geocode_admin1_polygon invoked with params (%, %, %, %)', username, orgname, admin1_name, country_name; RETURN NULL; END; $$ LANGUAGE 'plpgsql'; -- Exercise the public and the proxied function SELECT cdb_geocode_admin1_polygon('California'); -NOTICE: cdb_geocoder_client._cdb_geocode_admin1_polygon(3): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_admin1_polygon invoked with params (test_user, , California) -CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_admin1_polygon(username, orgname, admin1_name)" +NOTICE: cdb_dataservices_client._cdb_geocode_admin1_polygon(3): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_admin1_polygon invoked with params (test_user, , California) +CONTEXT: SQL statement "SELECT cdb_dataservices_client._cdb_geocode_admin1_polygon(username, orgname, admin1_name)" PL/pgSQL function cdb_geocode_admin1_polygon(text) line 15 at SQL statement cdb_geocode_admin1_polygon ---------------------------- @@ -26,8 +26,8 @@ PL/pgSQL function cdb_geocode_admin1_polygon(text) line 15 at SQL statement (1 row) SELECT cdb_geocode_admin1_polygon('California', 'United States'); -NOTICE: cdb_geocoder_client._cdb_geocode_admin1_polygon(4): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_admin1_polygon invoked with params (test_user, , California, United States) -CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_admin1_polygon(username, orgname, admin1_name, country_name)" +NOTICE: cdb_dataservices_client._cdb_geocode_admin1_polygon(4): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_admin1_polygon invoked with params (test_user, , California, United States) +CONTEXT: SQL statement "SELECT cdb_dataservices_client._cdb_geocode_admin1_polygon(username, orgname, admin1_name, country_name)" PL/pgSQL function cdb_geocode_admin1_polygon(text,text) line 15 at SQL statement cdb_geocode_admin1_polygon ---------------------------- diff --git a/client/test/0.1.0/expected/30_namedplaces_test.out b/client/test/0.1.0/expected/30_namedplaces_test.out index 4205dc0..c5db519 100644 --- a/client/test/0.1.0/expected/30_namedplaces_test.out +++ b/client/test/0.1.0/expected/30_namedplaces_test.out @@ -1,31 +1,31 @@ -- Add to the search path the schema -SET search_path TO public,cartodb,cdb_geocoder_client; +SET search_path TO public,cartodb,cdb_dataservices_client; -- Mock the server functions -CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text) +CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text) RETURNS Geometry AS $$ BEGIN - RAISE NOTICE 'cdb_geocoder_server.cdb_geocode_namedplace_point invoked with params (%, %, %)', username, orgname, city_name; + RAISE NOTICE 'cdb_dataservices_server.cdb_geocode_namedplace_point invoked with params (%, %, %)', username, orgname, city_name; RETURN NULL; END; $$ LANGUAGE 'plpgsql'; -CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, country_name text) +CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, country_name text) RETURNS Geometry AS $$ BEGIN - RAISE NOTICE 'cdb_geocoder_server.cdb_geocode_namedplace_point invoked with params (%, %, %, %)', username, orgname, city_name, country_name; + RAISE NOTICE 'cdb_dataservices_server.cdb_geocode_namedplace_point invoked with params (%, %, %, %)', username, orgname, city_name, country_name; RETURN NULL; END; $$ LANGUAGE 'plpgsql'; -CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, admin1_name text, country_name text) +CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, admin1_name text, country_name text) RETURNS Geometry AS $$ BEGIN - RAISE NOTICE 'cdb_geocoder_server.cdb_geocode_namedplace_point invoked with params (%, %, %, %, %)', username, orgname, city_name, admin1_name, country_name; + RAISE NOTICE 'cdb_dataservices_server.cdb_geocode_namedplace_point invoked with params (%, %, %, %, %)', username, orgname, city_name, admin1_name, country_name; RETURN NULL; END; $$ LANGUAGE 'plpgsql'; -- Exercise the public and the proxied function SELECT cdb_geocode_namedplace_point('Elx'); -NOTICE: cdb_geocoder_client._cdb_geocode_namedplace_point(3): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_namedplace_point invoked with params (test_user, , Elx) -CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_namedplace_point(username, orgname, city_name)" +NOTICE: cdb_dataservices_client._cdb_geocode_namedplace_point(3): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_namedplace_point invoked with params (test_user, , Elx) +CONTEXT: SQL statement "SELECT cdb_dataservices_client._cdb_geocode_namedplace_point(username, orgname, city_name)" PL/pgSQL function cdb_geocode_namedplace_point(text) line 15 at SQL statement cdb_geocode_namedplace_point ------------------------------ @@ -33,8 +33,8 @@ PL/pgSQL function cdb_geocode_namedplace_point(text) line 15 at SQL statement (1 row) SELECT cdb_geocode_namedplace_point('Elx', 'Spain'); -NOTICE: cdb_geocoder_client._cdb_geocode_namedplace_point(4): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_namedplace_point invoked with params (test_user, , Elx, Spain) -CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_namedplace_point(username, orgname, city_name, country_name)" +NOTICE: cdb_dataservices_client._cdb_geocode_namedplace_point(4): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_namedplace_point invoked with params (test_user, , Elx, Spain) +CONTEXT: SQL statement "SELECT cdb_dataservices_client._cdb_geocode_namedplace_point(username, orgname, city_name, country_name)" PL/pgSQL function cdb_geocode_namedplace_point(text,text) line 15 at SQL statement cdb_geocode_namedplace_point ------------------------------ @@ -42,8 +42,8 @@ PL/pgSQL function cdb_geocode_namedplace_point(text,text) line 15 at SQL stateme (1 row) SELECT cdb_geocode_namedplace_point('Elx', 'Valencia', 'Spain'); -NOTICE: cdb_geocoder_client._cdb_geocode_namedplace_point(5): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_namedplace_point invoked with params (test_user, , Elx, Valencia, Spain) -CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_namedplace_point(username, orgname, city_name, admin1_name, country_name)" +NOTICE: cdb_dataservices_client._cdb_geocode_namedplace_point(5): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_namedplace_point invoked with params (test_user, , Elx, Valencia, Spain) +CONTEXT: SQL statement "SELECT cdb_dataservices_client._cdb_geocode_namedplace_point(username, orgname, city_name, admin1_name, country_name)" PL/pgSQL function cdb_geocode_namedplace_point(text,text,text) line 15 at SQL statement cdb_geocode_namedplace_point ------------------------------ diff --git a/client/test/0.1.0/expected/40_postalcodes_test.out b/client/test/0.1.0/expected/40_postalcodes_test.out index 92d39d1..fae53ec 100644 --- a/client/test/0.1.0/expected/40_postalcodes_test.out +++ b/client/test/0.1.0/expected/40_postalcodes_test.out @@ -1,24 +1,24 @@ -- Add to the search path the schema -SET search_path TO public,cartodb,cdb_geocoder_client; +SET search_path TO public,cartodb,cdb_dataservices_client; -- Mock the server functions -CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_postalcode_polygon(username text, orgname text, postal_code text, country_name text) +CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_polygon(username text, orgname text, postal_code text, country_name text) RETURNS Geometry AS $$ BEGIN - RAISE NOTICE 'cdb_geocoder_server.cdb_geocode_postalcode_polygon invoked with params (%, %, %, %)', username, orgname, postal_code, country_name; + RAISE NOTICE 'cdb_dataservices_server.cdb_geocode_postalcode_polygon invoked with params (%, %, %, %)', username, orgname, postal_code, country_name; RETURN NULL; END; $$ LANGUAGE 'plpgsql'; -CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_postalcode_point(username text, orgname text, postal_code text, country_name text) +CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_point(username text, orgname text, postal_code text, country_name text) RETURNS Geometry AS $$ BEGIN - RAISE NOTICE 'cdb_geocoder_server.cdb_geocode_postalcode_point invoked with params (%, %, %, %)', username, orgname, postal_code, country_name; + RAISE NOTICE 'cdb_dataservices_server.cdb_geocode_postalcode_point invoked with params (%, %, %, %)', username, orgname, postal_code, country_name; RETURN NULL; END; $$ LANGUAGE 'plpgsql'; -- Exercise the public and the proxied function SELECT cdb_geocode_postalcode_polygon('03204', 'Spain'); -NOTICE: cdb_geocoder_client._cdb_geocode_postalcode_polygon(4): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_postalcode_polygon invoked with params (test_user, , 03204, Spain) -CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_postalcode_polygon(username, orgname, postal_code, country_name)" +NOTICE: cdb_dataservices_client._cdb_geocode_postalcode_polygon(4): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_postalcode_polygon invoked with params (test_user, , 03204, Spain) +CONTEXT: SQL statement "SELECT cdb_dataservices_client._cdb_geocode_postalcode_polygon(username, orgname, postal_code, country_name)" PL/pgSQL function cdb_geocode_postalcode_polygon(text,text) line 15 at SQL statement cdb_geocode_postalcode_polygon -------------------------------- @@ -26,8 +26,8 @@ PL/pgSQL function cdb_geocode_postalcode_polygon(text,text) line 15 at SQL state (1 row) SELECT cdb_geocode_postalcode_point('03204', 'Spain'); -NOTICE: cdb_geocoder_client._cdb_geocode_postalcode_point(4): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_postalcode_point invoked with params (test_user, , 03204, Spain) -CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_postalcode_point(username, orgname, postal_code, country_name)" +NOTICE: cdb_dataservices_client._cdb_geocode_postalcode_point(4): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_postalcode_point invoked with params (test_user, , 03204, Spain) +CONTEXT: SQL statement "SELECT cdb_dataservices_client._cdb_geocode_postalcode_point(username, orgname, postal_code, country_name)" PL/pgSQL function cdb_geocode_postalcode_point(text,text) line 15 at SQL statement cdb_geocode_postalcode_point ------------------------------ diff --git a/client/test/0.1.0/expected/50_ipaddresses_test.out b/client/test/0.1.0/expected/50_ipaddresses_test.out index 9a10179..18a18db 100644 --- a/client/test/0.1.0/expected/50_ipaddresses_test.out +++ b/client/test/0.1.0/expected/50_ipaddresses_test.out @@ -1,17 +1,17 @@ -- Add to the search path the schema -SET search_path TO public,cartodb,cdb_geocoder_client; +SET search_path TO public,cartodb,cdb_dataservices_client; -- Mock the server functions -CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_ipaddress_point(username text, orgname text, ip_address text) +CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_ipaddress_point(username text, orgname text, ip_address text) RETURNS Geometry AS $$ BEGIN - RAISE NOTICE 'cdb_geocoder_server.cdb_geocode_ipaddress_point invoked with params (%, %, %)', username, orgname, ip_address; + RAISE NOTICE 'cdb_dataservices_server.cdb_geocode_ipaddress_point invoked with params (%, %, %)', username, orgname, ip_address; RETURN NULL; END; $$ LANGUAGE 'plpgsql'; -- Exercise the public and the proxied function SELECT cdb_geocode_ipaddress_point('8.8.8.8'); -NOTICE: cdb_geocoder_client._cdb_geocode_ipaddress_point(3): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_ipaddress_point invoked with params (test_user, , 8.8.8.8) -CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_ipaddress_point(username, orgname, ip_address)" +NOTICE: cdb_dataservices_client._cdb_geocode_ipaddress_point(3): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_ipaddress_point invoked with params (test_user, , 8.8.8.8) +CONTEXT: SQL statement "SELECT cdb_dataservices_client._cdb_geocode_ipaddress_point(username, orgname, ip_address)" PL/pgSQL function cdb_geocode_ipaddress_point(text) line 15 at SQL statement cdb_geocode_ipaddress_point ----------------------------- diff --git a/client/test/0.1.0/expected/60_street_test.out b/client/test/0.1.0/expected/60_street_test.out index 443fde1..72a11f4 100644 --- a/client/test/0.1.0/expected/60_street_test.out +++ b/client/test/0.1.0/expected/60_street_test.out @@ -1,17 +1,17 @@ -- Add to the search path the schema -SET search_path TO public,cartodb,cdb_geocoder_client; +SET search_path TO public,cartodb,cdb_dataservices_client; -- Mock the server functions -CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_street_point (username text, orgname text, searchtext text, city text DEFAULT NULL, state_province text DEFAULT NULL, country text DEFAULT NULL) +CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_street_point (username text, orgname text, searchtext text, city text DEFAULT NULL, state_province text DEFAULT NULL, country text DEFAULT NULL) RETURNS Geometry AS $$ BEGIN - RAISE NOTICE 'cdb_geocoder_server.cdb_geocode_geocoder_street_point invoked with params (%, %, %, %, %, %)', username, orgname, searchtext, city, state_province, country; + RAISE NOTICE 'cdb_dataservices_server.cdb_geocode_geocoder_street_point invoked with params (%, %, %, %, %, %)', username, orgname, searchtext, city, state_province, country; RETURN NULL; END; $$ LANGUAGE 'plpgsql'; -- Exercise the public and the proxied function SELECT cdb_geocode_street_point('One street, 1'); -NOTICE: cdb_geocoder_client._cdb_geocode_street_point(6): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_geocoder_street_point invoked with params (test_user, , One street, 1, , , ) -CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_street_point(username, orgname, searchtext, city, state_province, country)" +NOTICE: cdb_dataservices_client._cdb_geocode_street_point(6): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_geocoder_street_point invoked with params (test_user, , One street, 1, , , ) +CONTEXT: SQL statement "SELECT cdb_dataservices_client._cdb_geocode_street_point(username, orgname, searchtext, city, state_province, country)" PL/pgSQL function cdb_geocode_street_point(text,text,text,text) line 15 at SQL statement cdb_geocode_street_point -------------------------- @@ -19,8 +19,8 @@ PL/pgSQL function cdb_geocode_street_point(text,text,text,text) line 15 at SQL s (1 row) SELECT cdb_geocode_street_point('One street', 'city'); -NOTICE: cdb_geocoder_client._cdb_geocode_street_point(6): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_geocoder_street_point invoked with params (test_user, , One street, city, , ) -CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_street_point(username, orgname, searchtext, city, state_province, country)" +NOTICE: cdb_dataservices_client._cdb_geocode_street_point(6): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_geocoder_street_point invoked with params (test_user, , One street, city, , ) +CONTEXT: SQL statement "SELECT cdb_dataservices_client._cdb_geocode_street_point(username, orgname, searchtext, city, state_province, country)" PL/pgSQL function cdb_geocode_street_point(text,text,text,text) line 15 at SQL statement cdb_geocode_street_point -------------------------- @@ -28,8 +28,8 @@ PL/pgSQL function cdb_geocode_street_point(text,text,text,text) line 15 at SQL s (1 row) SELECT cdb_geocode_street_point('One street', 'city', 'state'); -NOTICE: cdb_geocoder_client._cdb_geocode_street_point(6): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_geocoder_street_point invoked with params (test_user, , One street, city, state, ) -CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_street_point(username, orgname, searchtext, city, state_province, country)" +NOTICE: cdb_dataservices_client._cdb_geocode_street_point(6): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_geocoder_street_point invoked with params (test_user, , One street, city, state, ) +CONTEXT: SQL statement "SELECT cdb_dataservices_client._cdb_geocode_street_point(username, orgname, searchtext, city, state_province, country)" PL/pgSQL function cdb_geocode_street_point(text,text,text,text) line 15 at SQL statement cdb_geocode_street_point -------------------------- @@ -37,8 +37,8 @@ PL/pgSQL function cdb_geocode_street_point(text,text,text,text) line 15 at SQL s (1 row) SELECT cdb_geocode_street_point('One street', 'city', 'state', 'country'); -NOTICE: cdb_geocoder_client._cdb_geocode_street_point(6): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_geocoder_street_point invoked with params (test_user, , One street, city, state, country) -CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_street_point(username, orgname, searchtext, city, state_province, country)" +NOTICE: cdb_dataservices_client._cdb_geocode_street_point(6): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_geocoder_street_point invoked with params (test_user, , One street, city, state, country) +CONTEXT: SQL statement "SELECT cdb_dataservices_client._cdb_geocode_street_point(username, orgname, searchtext, city, state_province, country)" PL/pgSQL function cdb_geocode_street_point(text,text,text,text) line 15 at SQL statement cdb_geocode_street_point -------------------------- @@ -46,8 +46,8 @@ PL/pgSQL function cdb_geocode_street_point(text,text,text,text) line 15 at SQL s (1 row) SELECT cdb_geocode_street_point('One street', 'city', NULL, 'country'); -NOTICE: cdb_geocoder_client._cdb_geocode_street_point(6): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_geocoder_street_point invoked with params (test_user, , One street, city, , country) -CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_street_point(username, orgname, searchtext, city, state_province, country)" +NOTICE: cdb_dataservices_client._cdb_geocode_street_point(6): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_geocoder_street_point invoked with params (test_user, , One street, city, , country) +CONTEXT: SQL statement "SELECT cdb_dataservices_client._cdb_geocode_street_point(username, orgname, searchtext, city, state_province, country)" PL/pgSQL function cdb_geocode_street_point(text,text,text,text) line 15 at SQL statement cdb_geocode_street_point -------------------------- @@ -55,8 +55,8 @@ PL/pgSQL function cdb_geocode_street_point(text,text,text,text) line 15 at SQL s (1 row) SELECT cdb_geocode_street_point('One street, 1'); -NOTICE: cdb_geocoder_client._cdb_geocode_street_point(6): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_geocoder_street_point invoked with params (test_user, , One street, 1, , , ) -CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_street_point(username, orgname, searchtext, city, state_province, country)" +NOTICE: cdb_dataservices_client._cdb_geocode_street_point(6): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_geocoder_street_point invoked with params (test_user, , One street, 1, , , ) +CONTEXT: SQL statement "SELECT cdb_dataservices_client._cdb_geocode_street_point(username, orgname, searchtext, city, state_province, country)" PL/pgSQL function cdb_geocode_street_point(text,text,text,text) line 15 at SQL statement cdb_geocode_street_point -------------------------- @@ -64,8 +64,8 @@ PL/pgSQL function cdb_geocode_street_point(text,text,text,text) line 15 at SQL s (1 row) SELECT cdb_geocode_street_point('One street', 'city'); -NOTICE: cdb_geocoder_client._cdb_geocode_street_point(6): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_geocoder_street_point invoked with params (test_user, , One street, city, , ) -CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_street_point(username, orgname, searchtext, city, state_province, country)" +NOTICE: cdb_dataservices_client._cdb_geocode_street_point(6): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_geocoder_street_point invoked with params (test_user, , One street, city, , ) +CONTEXT: SQL statement "SELECT cdb_dataservices_client._cdb_geocode_street_point(username, orgname, searchtext, city, state_province, country)" PL/pgSQL function cdb_geocode_street_point(text,text,text,text) line 15 at SQL statement cdb_geocode_street_point -------------------------- @@ -73,8 +73,8 @@ PL/pgSQL function cdb_geocode_street_point(text,text,text,text) line 15 at SQL s (1 row) SELECT cdb_geocode_street_point('One street', 'city', 'state'); -NOTICE: cdb_geocoder_client._cdb_geocode_street_point(6): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_geocoder_street_point invoked with params (test_user, , One street, city, state, ) -CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_street_point(username, orgname, searchtext, city, state_province, country)" +NOTICE: cdb_dataservices_client._cdb_geocode_street_point(6): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_geocoder_street_point invoked with params (test_user, , One street, city, state, ) +CONTEXT: SQL statement "SELECT cdb_dataservices_client._cdb_geocode_street_point(username, orgname, searchtext, city, state_province, country)" PL/pgSQL function cdb_geocode_street_point(text,text,text,text) line 15 at SQL statement cdb_geocode_street_point -------------------------- @@ -82,8 +82,8 @@ PL/pgSQL function cdb_geocode_street_point(text,text,text,text) line 15 at SQL s (1 row) SELECT cdb_geocode_street_point('One street', 'city', 'state', 'country'); -NOTICE: cdb_geocoder_client._cdb_geocode_street_point(6): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_geocoder_street_point invoked with params (test_user, , One street, city, state, country) -CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_street_point(username, orgname, searchtext, city, state_province, country)" +NOTICE: cdb_dataservices_client._cdb_geocode_street_point(6): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_geocoder_street_point invoked with params (test_user, , One street, city, state, country) +CONTEXT: SQL statement "SELECT cdb_dataservices_client._cdb_geocode_street_point(username, orgname, searchtext, city, state_province, country)" PL/pgSQL function cdb_geocode_street_point(text,text,text,text) line 15 at SQL statement cdb_geocode_street_point -------------------------- @@ -91,8 +91,8 @@ PL/pgSQL function cdb_geocode_street_point(text,text,text,text) line 15 at SQL s (1 row) SELECT cdb_geocode_street_point('One street', 'city', NULL, 'country'); -NOTICE: cdb_geocoder_client._cdb_geocode_street_point(6): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_geocoder_street_point invoked with params (test_user, , One street, city, , country) -CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_street_point(username, orgname, searchtext, city, state_province, country)" +NOTICE: cdb_dataservices_client._cdb_geocode_street_point(6): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_geocoder_street_point invoked with params (test_user, , One street, city, , country) +CONTEXT: SQL statement "SELECT cdb_dataservices_client._cdb_geocode_street_point(username, orgname, searchtext, city, state_province, country)" PL/pgSQL function cdb_geocode_street_point(text,text,text,text) line 15 at SQL statement cdb_geocode_street_point -------------------------- diff --git a/client/test/0.1.0/expected/90_permissions_test.out b/client/test/0.1.0/expected/90_permissions_test.out index c7c69da..cea19cc 100644 --- a/client/test/0.1.0/expected/90_permissions_test.out +++ b/client/test/0.1.0/expected/90_permissions_test.out @@ -1,12 +1,12 @@ -- Use regular user role SET ROLE test_regular_user; -- Add to the search path the schema -SET search_path TO public,cartodb,cdb_geocoder_client; +SET search_path TO public,cartodb,cdb_dataservices_client; -- Exercise the public function -- it is public, it shall work SELECT cdb_geocode_admin0_polygon('Spain'); -NOTICE: cdb_geocoder_client._cdb_geocode_admin0_polygon(3): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_admin0_polygon invoked with params (test_user, , Spain) -CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_admin0_polygon(username, orgname, country_name)" +NOTICE: cdb_dataservices_client._cdb_geocode_admin0_polygon(3): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_admin0_polygon invoked with params (test_user, , Spain) +CONTEXT: SQL statement "SELECT cdb_dataservices_client._cdb_geocode_admin0_polygon(username, orgname, country_name)" PL/pgSQL function cdb_geocode_admin0_polygon(text) line 15 at SQL statement cdb_geocode_admin0_polygon ---------------------------- @@ -14,8 +14,8 @@ PL/pgSQL function cdb_geocode_admin0_polygon(text) line 15 at SQL statement (1 row) SELECT cdb_geocode_admin1_polygon('California'); -NOTICE: cdb_geocoder_client._cdb_geocode_admin1_polygon(3): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_admin1_polygon invoked with params (test_user, , California) -CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_admin1_polygon(username, orgname, admin1_name)" +NOTICE: cdb_dataservices_client._cdb_geocode_admin1_polygon(3): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_admin1_polygon invoked with params (test_user, , California) +CONTEXT: SQL statement "SELECT cdb_dataservices_client._cdb_geocode_admin1_polygon(username, orgname, admin1_name)" PL/pgSQL function cdb_geocode_admin1_polygon(text) line 15 at SQL statement cdb_geocode_admin1_polygon ---------------------------- @@ -23,8 +23,8 @@ PL/pgSQL function cdb_geocode_admin1_polygon(text) line 15 at SQL statement (1 row) SELECT cdb_geocode_admin1_polygon('California', 'United States'); -NOTICE: cdb_geocoder_client._cdb_geocode_admin1_polygon(4): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_admin1_polygon invoked with params (test_user, , California, United States) -CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_admin1_polygon(username, orgname, admin1_name, country_name)" +NOTICE: cdb_dataservices_client._cdb_geocode_admin1_polygon(4): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_admin1_polygon invoked with params (test_user, , California, United States) +CONTEXT: SQL statement "SELECT cdb_dataservices_client._cdb_geocode_admin1_polygon(username, orgname, admin1_name, country_name)" PL/pgSQL function cdb_geocode_admin1_polygon(text,text) line 15 at SQL statement cdb_geocode_admin1_polygon ---------------------------- @@ -32,8 +32,8 @@ PL/pgSQL function cdb_geocode_admin1_polygon(text,text) line 15 at SQL statement (1 row) SELECT cdb_geocode_namedplace_point('Elx'); -NOTICE: cdb_geocoder_client._cdb_geocode_namedplace_point(3): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_namedplace_point invoked with params (test_user, , Elx) -CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_namedplace_point(username, orgname, city_name)" +NOTICE: cdb_dataservices_client._cdb_geocode_namedplace_point(3): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_namedplace_point invoked with params (test_user, , Elx) +CONTEXT: SQL statement "SELECT cdb_dataservices_client._cdb_geocode_namedplace_point(username, orgname, city_name)" PL/pgSQL function cdb_geocode_namedplace_point(text) line 15 at SQL statement cdb_geocode_namedplace_point ------------------------------ @@ -41,8 +41,8 @@ PL/pgSQL function cdb_geocode_namedplace_point(text) line 15 at SQL statement (1 row) SELECT cdb_geocode_namedplace_point('Elx', 'Valencia'); -NOTICE: cdb_geocoder_client._cdb_geocode_namedplace_point(4): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_namedplace_point invoked with params (test_user, , Elx, Valencia) -CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_namedplace_point(username, orgname, city_name, country_name)" +NOTICE: cdb_dataservices_client._cdb_geocode_namedplace_point(4): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_namedplace_point invoked with params (test_user, , Elx, Valencia) +CONTEXT: SQL statement "SELECT cdb_dataservices_client._cdb_geocode_namedplace_point(username, orgname, city_name, country_name)" PL/pgSQL function cdb_geocode_namedplace_point(text,text) line 15 at SQL statement cdb_geocode_namedplace_point ------------------------------ @@ -50,8 +50,8 @@ PL/pgSQL function cdb_geocode_namedplace_point(text,text) line 15 at SQL stateme (1 row) SELECT cdb_geocode_namedplace_point('Elx', 'Valencia', 'Spain'); -NOTICE: cdb_geocoder_client._cdb_geocode_namedplace_point(5): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_namedplace_point invoked with params (test_user, , Elx, Valencia, Spain) -CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_namedplace_point(username, orgname, city_name, admin1_name, country_name)" +NOTICE: cdb_dataservices_client._cdb_geocode_namedplace_point(5): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_namedplace_point invoked with params (test_user, , Elx, Valencia, Spain) +CONTEXT: SQL statement "SELECT cdb_dataservices_client._cdb_geocode_namedplace_point(username, orgname, city_name, admin1_name, country_name)" PL/pgSQL function cdb_geocode_namedplace_point(text,text,text) line 15 at SQL statement cdb_geocode_namedplace_point ------------------------------ @@ -59,8 +59,8 @@ PL/pgSQL function cdb_geocode_namedplace_point(text,text,text) line 15 at SQL st (1 row) SELECT cdb_geocode_postalcode_polygon('03204', 'Spain'); -NOTICE: cdb_geocoder_client._cdb_geocode_postalcode_polygon(4): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_postalcode_polygon invoked with params (test_user, , 03204, Spain) -CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_postalcode_polygon(username, orgname, postal_code, country_name)" +NOTICE: cdb_dataservices_client._cdb_geocode_postalcode_polygon(4): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_postalcode_polygon invoked with params (test_user, , 03204, Spain) +CONTEXT: SQL statement "SELECT cdb_dataservices_client._cdb_geocode_postalcode_polygon(username, orgname, postal_code, country_name)" PL/pgSQL function cdb_geocode_postalcode_polygon(text,text) line 15 at SQL statement cdb_geocode_postalcode_polygon -------------------------------- @@ -68,8 +68,8 @@ PL/pgSQL function cdb_geocode_postalcode_polygon(text,text) line 15 at SQL state (1 row) SELECT cdb_geocode_postalcode_point('03204', 'Spain'); -NOTICE: cdb_geocoder_client._cdb_geocode_postalcode_point(4): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_postalcode_point invoked with params (test_user, , 03204, Spain) -CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_postalcode_point(username, orgname, postal_code, country_name)" +NOTICE: cdb_dataservices_client._cdb_geocode_postalcode_point(4): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_postalcode_point invoked with params (test_user, , 03204, Spain) +CONTEXT: SQL statement "SELECT cdb_dataservices_client._cdb_geocode_postalcode_point(username, orgname, postal_code, country_name)" PL/pgSQL function cdb_geocode_postalcode_point(text,text) line 15 at SQL statement cdb_geocode_postalcode_point ------------------------------ @@ -77,8 +77,8 @@ PL/pgSQL function cdb_geocode_postalcode_point(text,text) line 15 at SQL stateme (1 row) SELECT cdb_geocode_ipaddress_point('8.8.8.8'); -NOTICE: cdb_geocoder_client._cdb_geocode_ipaddress_point(3): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_ipaddress_point invoked with params (test_user, , 8.8.8.8) -CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_ipaddress_point(username, orgname, ip_address)" +NOTICE: cdb_dataservices_client._cdb_geocode_ipaddress_point(3): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_ipaddress_point invoked with params (test_user, , 8.8.8.8) +CONTEXT: SQL statement "SELECT cdb_dataservices_client._cdb_geocode_ipaddress_point(username, orgname, ip_address)" PL/pgSQL function cdb_geocode_ipaddress_point(text) line 15 at SQL statement cdb_geocode_ipaddress_point ----------------------------- @@ -86,8 +86,8 @@ PL/pgSQL function cdb_geocode_ipaddress_point(text) line 15 at SQL statement (1 row) SELECT cdb_geocode_street_point('one street, 1'); -NOTICE: cdb_geocoder_client._cdb_geocode_street_point(6): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.cdb_geocode_geocoder_street_point invoked with params (test_user, , one street, 1, , , ) -CONTEXT: SQL statement "SELECT cdb_geocoder_client._cdb_geocode_street_point(username, orgname, searchtext, city, state_province, country)" +NOTICE: cdb_dataservices_client._cdb_geocode_street_point(6): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_geocoder_street_point invoked with params (test_user, , one street, 1, , , ) +CONTEXT: SQL statement "SELECT cdb_dataservices_client._cdb_geocode_street_point(username, orgname, searchtext, city, state_province, country)" PL/pgSQL function cdb_geocode_street_point(text,text,text,text) line 15 at SQL statement cdb_geocode_street_point -------------------------- diff --git a/client/test/0.1.0/sql/00_installation_test.sql b/client/test/0.1.0/sql/00_installation_test.sql index 784fa03..fc3395f 100644 --- a/client/test/0.1.0/sql/00_installation_test.sql +++ b/client/test/0.1.0/sql/00_installation_test.sql @@ -6,7 +6,7 @@ CREATE EXTENSION cartodb; CREATE EXTENSION plproxy; -- Install the extension -CREATE EXTENSION cdb_geocoder_client; +CREATE EXTENSION cdb_dataservices_client; -- Mock the server connection to point to this very test db SELECT cartodb.cdb_conf_setconf('geocoder_server_config', '{"connection_str": "dbname=contrib_regression host=127.0.0.1 user=postgres"}'); @@ -14,10 +14,10 @@ SELECT cartodb.cdb_conf_setconf('geocoder_server_config', '{"connection_str": "d SELECT cartodb.cdb_conf_setconf('user_config', '{"is_organization": false, "entity_name": "test_user"}'); -- Mock the server schema -CREATE SCHEMA cdb_geocoder_server; +CREATE SCHEMA cdb_dataservices_server; -- Create a test user to check permissions 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 public,cartodb,cdb_geocoder_client; \ No newline at end of file +ALTER ROLE test_regular_user SET search_path TO public,cartodb,cdb_dataservices_client; diff --git a/client/test/0.1.0/sql/10_admin0_test.sql b/client/test/0.1.0/sql/10_admin0_test.sql index 5c3e488..e6750f1 100644 --- a/client/test/0.1.0/sql/10_admin0_test.sql +++ b/client/test/0.1.0/sql/10_admin0_test.sql @@ -1,11 +1,11 @@ -- Add to the search path the schema -SET search_path TO public,cartodb,cdb_geocoder_client; +SET search_path TO public,cartodb,cdb_dataservices_client; -- Mock the server function -CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_admin0_polygon(username text, orgname text, country_name text) +CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_admin0_polygon(username text, orgname text, country_name text) RETURNS Geometry AS $$ BEGIN - RAISE NOTICE 'cdb_geocoder_server.cdb_geocode_admin0_polygon invoked with params (%, %, %)', username, orgname, country_name; + RAISE NOTICE 'cdb_dataservices_server.cdb_geocode_admin0_polygon invoked with params (%, %, %)', username, orgname, country_name; RETURN NULL; END; $$ LANGUAGE 'plpgsql'; diff --git a/client/test/0.1.0/sql/20_admin1_test.sql b/client/test/0.1.0/sql/20_admin1_test.sql index a8a2075..ecd2275 100644 --- a/client/test/0.1.0/sql/20_admin1_test.sql +++ b/client/test/0.1.0/sql/20_admin1_test.sql @@ -1,19 +1,19 @@ -- Add to the search path the schema -SET search_path TO public,cartodb,cdb_geocoder_client; +SET search_path TO public,cartodb,cdb_dataservices_client; -- Mock the server functions -CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_admin1_polygon(username text, orgname text, admin1_name text) +CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_admin1_polygon(username text, orgname text, admin1_name text) RETURNS Geometry AS $$ BEGIN - RAISE NOTICE 'cdb_geocoder_server.cdb_geocode_admin1_polygon invoked with params (%, %, %)', username, orgname, admin1_name; + RAISE NOTICE 'cdb_dataservices_server.cdb_geocode_admin1_polygon invoked with params (%, %, %)', username, orgname, admin1_name; RETURN NULL; END; $$ LANGUAGE 'plpgsql'; -CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_admin1_polygon(username text, orgname text, admin1_name text, country_name text) +CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_admin1_polygon(username text, orgname text, admin1_name text, country_name text) RETURNS Geometry AS $$ BEGIN - RAISE NOTICE 'cdb_geocoder_server.cdb_geocode_admin1_polygon invoked with params (%, %, %, %)', username, orgname, admin1_name, country_name; + RAISE NOTICE 'cdb_dataservices_server.cdb_geocode_admin1_polygon invoked with params (%, %, %, %)', username, orgname, admin1_name, country_name; RETURN NULL; END; $$ LANGUAGE 'plpgsql'; diff --git a/client/test/0.1.0/sql/30_namedplaces_test.sql b/client/test/0.1.0/sql/30_namedplaces_test.sql index 3309cf5..bdfba65 100644 --- a/client/test/0.1.0/sql/30_namedplaces_test.sql +++ b/client/test/0.1.0/sql/30_namedplaces_test.sql @@ -1,27 +1,27 @@ -- Add to the search path the schema -SET search_path TO public,cartodb,cdb_geocoder_client; +SET search_path TO public,cartodb,cdb_dataservices_client; -- Mock the server functions -CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text) +CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text) RETURNS Geometry AS $$ BEGIN - RAISE NOTICE 'cdb_geocoder_server.cdb_geocode_namedplace_point invoked with params (%, %, %)', username, orgname, city_name; + RAISE NOTICE 'cdb_dataservices_server.cdb_geocode_namedplace_point invoked with params (%, %, %)', username, orgname, city_name; RETURN NULL; END; $$ LANGUAGE 'plpgsql'; -CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, country_name text) +CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, country_name text) RETURNS Geometry AS $$ BEGIN - RAISE NOTICE 'cdb_geocoder_server.cdb_geocode_namedplace_point invoked with params (%, %, %, %)', username, orgname, city_name, country_name; + RAISE NOTICE 'cdb_dataservices_server.cdb_geocode_namedplace_point invoked with params (%, %, %, %)', username, orgname, city_name, country_name; RETURN NULL; END; $$ LANGUAGE 'plpgsql'; -CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, admin1_name text, country_name text) +CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_namedplace_point(username text, orgname text, city_name text, admin1_name text, country_name text) RETURNS Geometry AS $$ BEGIN - RAISE NOTICE 'cdb_geocoder_server.cdb_geocode_namedplace_point invoked with params (%, %, %, %, %)', username, orgname, city_name, admin1_name, country_name; + RAISE NOTICE 'cdb_dataservices_server.cdb_geocode_namedplace_point invoked with params (%, %, %, %, %)', username, orgname, city_name, admin1_name, country_name; RETURN NULL; END; $$ LANGUAGE 'plpgsql'; diff --git a/client/test/0.1.0/sql/40_postalcodes_test.sql b/client/test/0.1.0/sql/40_postalcodes_test.sql index b5aafc6..c1c2191 100644 --- a/client/test/0.1.0/sql/40_postalcodes_test.sql +++ b/client/test/0.1.0/sql/40_postalcodes_test.sql @@ -1,19 +1,19 @@ -- Add to the search path the schema -SET search_path TO public,cartodb,cdb_geocoder_client; +SET search_path TO public,cartodb,cdb_dataservices_client; -- Mock the server functions -CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_postalcode_polygon(username text, orgname text, postal_code text, country_name text) +CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_polygon(username text, orgname text, postal_code text, country_name text) RETURNS Geometry AS $$ BEGIN - RAISE NOTICE 'cdb_geocoder_server.cdb_geocode_postalcode_polygon invoked with params (%, %, %, %)', username, orgname, postal_code, country_name; + RAISE NOTICE 'cdb_dataservices_server.cdb_geocode_postalcode_polygon invoked with params (%, %, %, %)', username, orgname, postal_code, country_name; RETURN NULL; END; $$ LANGUAGE 'plpgsql'; -CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_postalcode_point(username text, orgname text, postal_code text, country_name text) +CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_point(username text, orgname text, postal_code text, country_name text) RETURNS Geometry AS $$ BEGIN - RAISE NOTICE 'cdb_geocoder_server.cdb_geocode_postalcode_point invoked with params (%, %, %, %)', username, orgname, postal_code, country_name; + RAISE NOTICE 'cdb_dataservices_server.cdb_geocode_postalcode_point invoked with params (%, %, %, %)', username, orgname, postal_code, country_name; RETURN NULL; END; $$ LANGUAGE 'plpgsql'; diff --git a/client/test/0.1.0/sql/50_ipaddresses_test.sql b/client/test/0.1.0/sql/50_ipaddresses_test.sql index 09a3342..c1fd8f7 100644 --- a/client/test/0.1.0/sql/50_ipaddresses_test.sql +++ b/client/test/0.1.0/sql/50_ipaddresses_test.sql @@ -1,11 +1,11 @@ -- Add to the search path the schema -SET search_path TO public,cartodb,cdb_geocoder_client; +SET search_path TO public,cartodb,cdb_dataservices_client; -- Mock the server functions -CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_ipaddress_point(username text, orgname text, ip_address text) +CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_ipaddress_point(username text, orgname text, ip_address text) RETURNS Geometry AS $$ BEGIN - RAISE NOTICE 'cdb_geocoder_server.cdb_geocode_ipaddress_point invoked with params (%, %, %)', username, orgname, ip_address; + RAISE NOTICE 'cdb_dataservices_server.cdb_geocode_ipaddress_point invoked with params (%, %, %)', username, orgname, ip_address; RETURN NULL; END; $$ LANGUAGE 'plpgsql'; diff --git a/client/test/0.1.0/sql/60_street_test.sql b/client/test/0.1.0/sql/60_street_test.sql index 349816d..cd22b5e 100644 --- a/client/test/0.1.0/sql/60_street_test.sql +++ b/client/test/0.1.0/sql/60_street_test.sql @@ -1,11 +1,11 @@ -- Add to the search path the schema -SET search_path TO public,cartodb,cdb_geocoder_client; +SET search_path TO public,cartodb,cdb_dataservices_client; -- Mock the server functions -CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_street_point (username text, orgname text, searchtext text, city text DEFAULT NULL, state_province text DEFAULT NULL, country text DEFAULT NULL) +CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_street_point (username text, orgname text, searchtext text, city text DEFAULT NULL, state_province text DEFAULT NULL, country text DEFAULT NULL) RETURNS Geometry AS $$ BEGIN - RAISE NOTICE 'cdb_geocoder_server.cdb_geocode_geocoder_street_point invoked with params (%, %, %, %, %, %)', username, orgname, searchtext, city, state_province, country; + RAISE NOTICE 'cdb_dataservices_server.cdb_geocode_geocoder_street_point invoked with params (%, %, %, %, %, %)', username, orgname, searchtext, city, state_province, country; RETURN NULL; END; $$ LANGUAGE 'plpgsql'; diff --git a/client/test/0.1.0/sql/90_permissions_test.sql b/client/test/0.1.0/sql/90_permissions_test.sql index 946936e..88ec14c 100644 --- a/client/test/0.1.0/sql/90_permissions_test.sql +++ b/client/test/0.1.0/sql/90_permissions_test.sql @@ -2,7 +2,7 @@ SET ROLE test_regular_user; -- Add to the search path the schema -SET search_path TO public,cartodb,cdb_geocoder_client; +SET search_path TO public,cartodb,cdb_dataservices_client; -- Exercise the public function -- it is public, it shall work