Removed the old versioning system
This commit is contained in:
parent
1e30b21d35
commit
b4f4ac1d99
1
client/.gitignore
vendored
1
client/.gitignore
vendored
@ -7,3 +7,4 @@ regression.out
|
||||
cdb_geocoder_client--0.0.1.sql
|
||||
cdb_geocoder_client--0.1.0.sql
|
||||
cdb_geocoder_client--0.2.0.sql
|
||||
cdb_geocoder_client--0.3.0.sql
|
@ -17,8 +17,8 @@ DATA = $(NEW_EXTENSION_ARTIFACT) \
|
||||
cdb_dataservices_client--0.3.0--0.2.0.sql
|
||||
|
||||
|
||||
REGRESS = $(notdir $(basename $(wildcard test/$(EXTVERSION)/sql/*test.sql)))
|
||||
TEST_DIR = test/$(EXTVERSION)
|
||||
REGRESS = $(notdir $(basename $(wildcard test/sql/*test.sql)))
|
||||
TEST_DIR = test/
|
||||
REGRESS_OPTS = --inputdir='$(TEST_DIR)' --outputdir='$(TEST_DIR)'
|
||||
|
||||
# postgres build stuff
|
||||
@ -26,11 +26,11 @@ PG_CONFIG = pg_config
|
||||
PGXS := $(shell $(PG_CONFIG) --pgxs)
|
||||
include $(PGXS)
|
||||
|
||||
SOURCES_DATA_DIR = sql/$(EXTVERSION)
|
||||
SOURCES_DATA_DIR = sql/
|
||||
|
||||
# The interface definition is used along with some templates to automatically generate code
|
||||
RENDERER = renderer/sql-template-renderer
|
||||
INTERFACE_FILE = renderer/interfaces/interface_$(EXTVERSION).yaml
|
||||
INTERFACE_FILE = renderer/interface.yaml
|
||||
TEMPLATE_DIR = renderer/templates
|
||||
TEMPLATE_FILES = $(wildcard $(TEMPLATE_DIR)/*.erb)
|
||||
GENERATED_SQL_FILES = $(patsubst $(TEMPLATE_DIR)/%.erb, $(SOURCES_DATA_DIR)/%.sql, $(TEMPLATE_FILES))
|
||||
|
@ -1,52 +0,0 @@
|
||||
---
|
||||
- name: cdb_geocode_admin0_polygon
|
||||
return_type: Geometry
|
||||
params:
|
||||
- { name: country_name, type: text }
|
||||
|
||||
- name: cdb_geocode_admin1_polygon
|
||||
return_type: Geometry
|
||||
params:
|
||||
- { name: admin1_name, type: text }
|
||||
|
||||
- name: cdb_geocode_admin1_polygon
|
||||
return_type: Geometry
|
||||
params:
|
||||
- { name: admin1_name, type: text }
|
||||
- { name: country_name, type: text }
|
||||
|
||||
- name: cdb_geocode_namedplace_point
|
||||
return_type: Geometry
|
||||
params:
|
||||
- { name: city_name, type: text}
|
||||
|
||||
- name: cdb_geocode_namedplace_point
|
||||
return_type: Geometry
|
||||
params:
|
||||
- { name: city_name, type: text}
|
||||
- { name: country_name, type: text}
|
||||
|
||||
- name: cdb_geocode_namedplace_point
|
||||
return_type: Geometry
|
||||
params:
|
||||
- { name: city_name, type: text}
|
||||
- { name: admin1_name, type: text}
|
||||
- { name: country_name, type: text}
|
||||
|
||||
|
||||
- name: cdb_geocode_postalcode_polygon
|
||||
return_type: Geometry
|
||||
params:
|
||||
- { name: postal_code, type: text}
|
||||
- { name: country_name, type: text}
|
||||
|
||||
- name: cdb_geocode_postalcode_point
|
||||
return_type: Geometry
|
||||
params:
|
||||
- { name: postal_code, type: text}
|
||||
- { name: country_name, type: text}
|
||||
|
||||
- name: cdb_geocode_ipaddress_point
|
||||
return_type: Geometry
|
||||
params:
|
||||
- { name: ip_address, type: text}
|
@ -1,60 +0,0 @@
|
||||
---
|
||||
- name: cdb_geocode_admin0_polygon
|
||||
return_type: Geometry
|
||||
params:
|
||||
- { name: country_name, type: text }
|
||||
|
||||
- name: cdb_geocode_admin1_polygon
|
||||
return_type: Geometry
|
||||
params:
|
||||
- { name: admin1_name, type: text }
|
||||
|
||||
- name: cdb_geocode_admin1_polygon
|
||||
return_type: Geometry
|
||||
params:
|
||||
- { name: admin1_name, type: text }
|
||||
- { name: country_name, type: text }
|
||||
|
||||
- name: cdb_geocode_namedplace_point
|
||||
return_type: Geometry
|
||||
params:
|
||||
- { name: city_name, type: text}
|
||||
|
||||
- name: cdb_geocode_namedplace_point
|
||||
return_type: Geometry
|
||||
params:
|
||||
- { name: city_name, type: text}
|
||||
- { name: country_name, type: text}
|
||||
|
||||
- name: cdb_geocode_namedplace_point
|
||||
return_type: Geometry
|
||||
params:
|
||||
- { name: city_name, type: text}
|
||||
- { name: admin1_name, type: text}
|
||||
- { name: country_name, type: text}
|
||||
|
||||
|
||||
- name: cdb_geocode_postalcode_polygon
|
||||
return_type: Geometry
|
||||
params:
|
||||
- { name: postal_code, type: text}
|
||||
- { name: country_name, type: text}
|
||||
|
||||
- name: cdb_geocode_postalcode_point
|
||||
return_type: Geometry
|
||||
params:
|
||||
- { name: postal_code, type: text}
|
||||
- { name: country_name, type: text}
|
||||
|
||||
- name: cdb_geocode_ipaddress_point
|
||||
return_type: Geometry
|
||||
params:
|
||||
- { name: ip_address, type: text}
|
||||
|
||||
- name: cdb_geocode_street_point
|
||||
return_type: Geometry
|
||||
params:
|
||||
- { name: searchtext, type: text}
|
||||
- { name: city, type: text, default: 'NULL'}
|
||||
- { name: state_province, type: text, default: 'NULL'}
|
||||
- { name: country, type: text, default: 'NULL'}
|
@ -1,79 +0,0 @@
|
||||
---
|
||||
- name: cdb_geocode_admin0_polygon
|
||||
return_type: Geometry
|
||||
params:
|
||||
- { name: country_name, type: text }
|
||||
|
||||
- name: cdb_geocode_admin1_polygon
|
||||
return_type: Geometry
|
||||
params:
|
||||
- { name: admin1_name, type: text }
|
||||
|
||||
- name: cdb_geocode_admin1_polygon
|
||||
return_type: Geometry
|
||||
params:
|
||||
- { name: admin1_name, type: text }
|
||||
- { name: country_name, type: text }
|
||||
|
||||
- name: cdb_geocode_namedplace_point
|
||||
return_type: Geometry
|
||||
params:
|
||||
- { name: city_name, type: text}
|
||||
|
||||
- name: cdb_geocode_namedplace_point
|
||||
return_type: Geometry
|
||||
params:
|
||||
- { name: city_name, type: text}
|
||||
- { name: country_name, type: text}
|
||||
|
||||
- name: cdb_geocode_namedplace_point
|
||||
return_type: Geometry
|
||||
params:
|
||||
- { name: city_name, type: text}
|
||||
- { name: admin1_name, type: text}
|
||||
- { name: country_name, type: text}
|
||||
|
||||
|
||||
- name: cdb_geocode_postalcode_polygon
|
||||
return_type: Geometry
|
||||
params:
|
||||
- { name: postal_code, type: text}
|
||||
- { name: country_name, type: text}
|
||||
|
||||
- name: cdb_geocode_postalcode_point
|
||||
return_type: Geometry
|
||||
params:
|
||||
- { name: postal_code, type: text}
|
||||
- { name: country_name, type: text}
|
||||
|
||||
- name: cdb_geocode_ipaddress_point
|
||||
return_type: Geometry
|
||||
params:
|
||||
- { name: ip_address, type: text}
|
||||
|
||||
- name: cdb_geocode_street_point
|
||||
return_type: Geometry
|
||||
params:
|
||||
- { name: searchtext, type: text}
|
||||
- { name: city, type: text, default: 'NULL'}
|
||||
- { name: state_province, type: text, default: 'NULL'}
|
||||
- { name: country, type: text, default: 'NULL'}
|
||||
|
||||
- name: cdb_isodistance
|
||||
return_type: SETOF cdb_dataservices_client.isoline
|
||||
multi_row: true
|
||||
params:
|
||||
- { name: source, type: "geometry(Geometry, 4326)" }
|
||||
- { name: mode, type: text }
|
||||
- { name: range, type: "integer[]" }
|
||||
- { name: options, type: "text[]", default: 'ARRAY[]::text[]' }
|
||||
|
||||
- name: cdb_isochrone
|
||||
return_type: SETOF cdb_dataservices_client.isoline
|
||||
multi_row: true
|
||||
params:
|
||||
- { name: source, type: "geometry(Geometry, 4326)" }
|
||||
- { name: mode, type: text }
|
||||
- { name: range, type: "integer[]" }
|
||||
- { name: options, type: "text[]", default: 'ARRAY[]::text[]' }
|
||||
|
@ -1,16 +0,0 @@
|
||||
--
|
||||
-- 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';
|
@ -1,37 +0,0 @@
|
||||
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;
|
@ -1,3 +0,0 @@
|
||||
--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
|
@ -1,16 +0,0 @@
|
||||
--
|
||||
-- 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';
|
@ -1,37 +0,0 @@
|
||||
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;
|
@ -1,9 +0,0 @@
|
||||
-- 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;
|
@ -1,3 +0,0 @@
|
||||
--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
|
@ -1,5 +0,0 @@
|
||||
CREATE TYPE cdb_dataservices_client.isoline AS (
|
||||
center geometry(Geometry,4326),
|
||||
data_range integer,
|
||||
the_geom geometry(Multipolygon,4326)
|
||||
);
|
@ -1,9 +0,0 @@
|
||||
-- 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;
|
@ -1 +0,0 @@
|
||||
../0.2.0/00_header.sql
|
@ -1 +0,0 @@
|
||||
../0.2.0/10_geocoder_server_conn.sql
|
@ -1 +0,0 @@
|
||||
../0.2.0/15_config_management.sql
|
@ -1 +0,0 @@
|
||||
../0.2.0/80_permissions.sql
|
@ -13,4 +13,4 @@ BEGIN
|
||||
SELECT trim(both '"' FROM db_connection_str) INTO db_connection_str;
|
||||
RETURN db_connection_str;
|
||||
END;
|
||||
$$ LANGUAGE 'plpgsql';
|
||||
$$ LANGUAGE 'plpgsql';
|
@ -34,4 +34,4 @@ BEGIN
|
||||
result.organization_name = organization_name;
|
||||
RETURN result;
|
||||
END;
|
||||
$$ LANGUAGE 'plpgsql' SECURITY DEFINER;
|
||||
$$ LANGUAGE 'plpgsql' SECURITY DEFINER;
|
@ -6,4 +6,4 @@ REVOKE ALL PRIVILEGES ON SCHEMA cdb_dataservices_client FROM PUBLIC, 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_dataservices_client FROM PUBLIC, publicuser;
|
||||
REVOKE EXECUTE ON ALL FUNCTIONS IN SCHEMA cdb_dataservices_client FROM PUBLIC, publicuser;
|
@ -1,20 +0,0 @@
|
||||
-- Add to the search path the schema
|
||||
SET search_path TO public,cartodb,cdb_dataservices_client;
|
||||
-- Mock the server function
|
||||
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_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_dataservices_client._cdb_geocode_admin0_polygon(3): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_admin0_polygon invoked with params ("test_user", <NULL>, 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
|
||||
----------------------------
|
||||
|
||||
(1 row)
|
||||
|
@ -1,36 +0,0 @@
|
||||
-- Add to the search path the schema
|
||||
SET search_path TO public,cartodb,cdb_dataservices_client;
|
||||
-- Mock the server functions
|
||||
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_dataservices_server.cdb_geocode_admin1_polygon invoked with params (%, %, %)', username, orgname, admin1_name;
|
||||
RETURN NULL;
|
||||
END;
|
||||
$$ LANGUAGE 'plpgsql';
|
||||
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_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_dataservices_client._cdb_geocode_admin1_polygon(3): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_admin1_polygon invoked with params ("test_user", <NULL>, 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
|
||||
----------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocode_admin1_polygon('California', 'United States');
|
||||
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", <NULL>, 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
|
||||
----------------------------
|
||||
|
||||
(1 row)
|
||||
|
@ -1,52 +0,0 @@
|
||||
-- Add to the search path the schema
|
||||
SET search_path TO public,cartodb,cdb_dataservices_client;
|
||||
-- Mock the server functions
|
||||
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_dataservices_server.cdb_geocode_namedplace_point invoked with params (%, %, %)', username, orgname, city_name;
|
||||
RETURN NULL;
|
||||
END;
|
||||
$$ LANGUAGE 'plpgsql';
|
||||
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_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_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_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_dataservices_client._cdb_geocode_namedplace_point(3): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_namedplace_point invoked with params ("test_user", <NULL>, 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
|
||||
------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocode_namedplace_point('Elx', 'Spain');
|
||||
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", <NULL>, 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
|
||||
------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocode_namedplace_point('Elx', 'Valencia', 'Spain');
|
||||
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", <NULL>, 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
|
||||
------------------------------
|
||||
|
||||
(1 row)
|
||||
|
@ -1,36 +0,0 @@
|
||||
-- Add to the search path the schema
|
||||
SET search_path TO public,cartodb,cdb_dataservices_client;
|
||||
-- Mock the server functions
|
||||
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_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_dataservices_server.cdb_geocode_postalcode_point(username text, orgname text, postal_code text, country_name text)
|
||||
RETURNS Geometry AS $$
|
||||
BEGIN
|
||||
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_dataservices_client._cdb_geocode_postalcode_polygon(4): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_postalcode_polygon invoked with params ("test_user", <NULL>, 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
|
||||
--------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocode_postalcode_point('03204', 'Spain');
|
||||
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", <NULL>, 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
|
||||
------------------------------
|
||||
|
||||
(1 row)
|
||||
|
@ -1,20 +0,0 @@
|
||||
-- Add to the search path the schema
|
||||
SET search_path TO public,cartodb,cdb_dataservices_client;
|
||||
-- Mock the server functions
|
||||
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_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_dataservices_client._cdb_geocode_ipaddress_point(3): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_ipaddress_point invoked with params ("test_user", <NULL>, 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
|
||||
-----------------------------
|
||||
|
||||
(1 row)
|
||||
|
@ -1,106 +0,0 @@
|
||||
-- Use regular user role
|
||||
SET ROLE test_regular_user;
|
||||
-- Add to the search path the schema
|
||||
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_dataservices_client._cdb_geocode_admin0_polygon(3): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_admin0_polygon invoked with params ("test_user", <NULL>, 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
|
||||
----------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocode_admin1_polygon('California');
|
||||
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", <NULL>, 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
|
||||
----------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocode_admin1_polygon('California', 'United States');
|
||||
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", <NULL>, 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
|
||||
----------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocode_namedplace_point('Elx');
|
||||
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", <NULL>, 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
|
||||
------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocode_namedplace_point('Elx', 'Valencia');
|
||||
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", <NULL>, 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
|
||||
------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocode_namedplace_point('Elx', 'Valencia', 'Spain');
|
||||
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", <NULL>, 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
|
||||
------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocode_postalcode_polygon('03204', 'Spain');
|
||||
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", <NULL>, 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
|
||||
--------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocode_postalcode_point('03204', 'Spain');
|
||||
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", <NULL>, 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
|
||||
------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocode_ipaddress_point('8.8.8.8');
|
||||
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", <NULL>, 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
|
||||
-----------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
-- Check the regular user has no permissions on private functions
|
||||
SELECT _cdb_geocode_admin0_polygon('evil_user', 'evil_orgname', 'Hell');
|
||||
ERROR: permission denied for function _cdb_geocode_admin0_polygon
|
||||
SELECT _cdb_geocode_admin1_polygon('evil_user', 'evil_orgname', 'Hell');
|
||||
ERROR: permission denied for function _cdb_geocode_admin1_polygon
|
||||
SELECT _cdb_geocode_admin1_polygon('evil_user', 'evil_orgname', 'Sheol', 'Hell');
|
||||
ERROR: permission denied for function _cdb_geocode_admin1_polygon
|
||||
SELECT _cdb_geocode_namedplace_point('evil_user', 'evil_orgname', 'Sheol');
|
||||
ERROR: permission denied for function _cdb_geocode_namedplace_point
|
||||
SELECT _cdb_geocode_namedplace_point('evil_user', 'evil_orgname', 'Sheol', 'Hell');
|
||||
ERROR: permission denied for function _cdb_geocode_namedplace_point
|
||||
SELECT _cdb_geocode_namedplace_point('evil_user', 'evil_orgname', 'Sheol', 'Hell', 'Ugly world');
|
||||
ERROR: permission denied for function _cdb_geocode_namedplace_point
|
||||
SELECT _cdb_geocode_postalcode_polygon('evil_user', 'evil_orgname', '66666', 'Hell');
|
||||
ERROR: permission denied for function _cdb_geocode_postalcode_polygon
|
||||
SELECT _cdb_geocode_postalcode_point('evil_user', 'evil_orgname', '66666', 'Hell');
|
||||
ERROR: permission denied for function _cdb_geocode_postalcode_point
|
||||
SELECT _cdb_geocode_ipaddress_point('evil_user', 'evil_orgname', '8.8.8.8');
|
||||
ERROR: permission denied for function _cdb_geocode_ipaddress_point
|
@ -1,28 +0,0 @@
|
||||
-- Use regular user role
|
||||
SET ROLE test_regular_user;
|
||||
|
||||
-- Add to the search path the schema
|
||||
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');
|
||||
SELECT cdb_geocode_admin1_polygon('California');
|
||||
SELECT cdb_geocode_admin1_polygon('California', 'United States');
|
||||
SELECT cdb_geocode_namedplace_point('Elx');
|
||||
SELECT cdb_geocode_namedplace_point('Elx', 'Valencia');
|
||||
SELECT cdb_geocode_namedplace_point('Elx', 'Valencia', 'Spain');
|
||||
SELECT cdb_geocode_postalcode_polygon('03204', 'Spain');
|
||||
SELECT cdb_geocode_postalcode_point('03204', 'Spain');
|
||||
SELECT cdb_geocode_ipaddress_point('8.8.8.8');
|
||||
|
||||
-- Check the regular user has no permissions on private functions
|
||||
SELECT _cdb_geocode_admin0_polygon('evil_user', 'evil_orgname', 'Hell');
|
||||
SELECT _cdb_geocode_admin1_polygon('evil_user', 'evil_orgname', 'Hell');
|
||||
SELECT _cdb_geocode_admin1_polygon('evil_user', 'evil_orgname', 'Sheol', 'Hell');
|
||||
SELECT _cdb_geocode_namedplace_point('evil_user', 'evil_orgname', 'Sheol');
|
||||
SELECT _cdb_geocode_namedplace_point('evil_user', 'evil_orgname', 'Sheol', 'Hell');
|
||||
SELECT _cdb_geocode_namedplace_point('evil_user', 'evil_orgname', 'Sheol', 'Hell', 'Ugly world');
|
||||
SELECT _cdb_geocode_postalcode_polygon('evil_user', 'evil_orgname', '66666', 'Hell');
|
||||
SELECT _cdb_geocode_postalcode_point('evil_user', 'evil_orgname', '66666', 'Hell');
|
||||
SELECT _cdb_geocode_ipaddress_point('evil_user', 'evil_orgname', '8.8.8.8');
|
@ -1,29 +0,0 @@
|
||||
-- Install dependencies
|
||||
CREATE EXTENSION postgis;
|
||||
CREATE EXTENSION schema_triggers;
|
||||
CREATE EXTENSION plpythonu;
|
||||
CREATE EXTENSION cartodb;
|
||||
CREATE EXTENSION plproxy;
|
||||
-- Install the extension
|
||||
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
|
||||
------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
-- Mock the user configuration
|
||||
SELECT cartodb.cdb_conf_setconf('user_config', '{"is_organization": false, "entity_name": "test_user"}');
|
||||
cdb_conf_setconf
|
||||
------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
-- Mock the server schema
|
||||
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_dataservices_client;
|
@ -1,20 +0,0 @@
|
||||
-- Add to the search path the schema
|
||||
SET search_path TO public,cartodb,cdb_dataservices_client;
|
||||
-- Mock the server function
|
||||
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_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_dataservices_client._cdb_geocode_admin0_polygon(3): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_admin0_polygon invoked with params (test_user, <NULL>, 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
|
||||
----------------------------
|
||||
|
||||
(1 row)
|
||||
|
@ -1,36 +0,0 @@
|
||||
-- Add to the search path the schema
|
||||
SET search_path TO public,cartodb,cdb_dataservices_client;
|
||||
-- Mock the server functions
|
||||
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_dataservices_server.cdb_geocode_admin1_polygon invoked with params (%, %, %)', username, orgname, admin1_name;
|
||||
RETURN NULL;
|
||||
END;
|
||||
$$ LANGUAGE 'plpgsql';
|
||||
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_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_dataservices_client._cdb_geocode_admin1_polygon(3): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_admin1_polygon invoked with params (test_user, <NULL>, 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
|
||||
----------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocode_admin1_polygon('California', 'United States');
|
||||
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, <NULL>, 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
|
||||
----------------------------
|
||||
|
||||
(1 row)
|
||||
|
@ -1,52 +0,0 @@
|
||||
-- Add to the search path the schema
|
||||
SET search_path TO public,cartodb,cdb_dataservices_client;
|
||||
-- Mock the server functions
|
||||
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_dataservices_server.cdb_geocode_namedplace_point invoked with params (%, %, %)', username, orgname, city_name;
|
||||
RETURN NULL;
|
||||
END;
|
||||
$$ LANGUAGE 'plpgsql';
|
||||
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_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_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_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_dataservices_client._cdb_geocode_namedplace_point(3): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_namedplace_point invoked with params (test_user, <NULL>, 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
|
||||
------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocode_namedplace_point('Elx', 'Spain');
|
||||
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, <NULL>, 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
|
||||
------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocode_namedplace_point('Elx', 'Valencia', 'Spain');
|
||||
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, <NULL>, 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
|
||||
------------------------------
|
||||
|
||||
(1 row)
|
||||
|
@ -1,36 +0,0 @@
|
||||
-- Add to the search path the schema
|
||||
SET search_path TO public,cartodb,cdb_dataservices_client;
|
||||
-- Mock the server functions
|
||||
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_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_dataservices_server.cdb_geocode_postalcode_point(username text, orgname text, postal_code text, country_name text)
|
||||
RETURNS Geometry AS $$
|
||||
BEGIN
|
||||
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_dataservices_client._cdb_geocode_postalcode_polygon(4): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_postalcode_polygon invoked with params (test_user, <NULL>, 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
|
||||
--------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocode_postalcode_point('03204', 'Spain');
|
||||
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, <NULL>, 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
|
||||
------------------------------
|
||||
|
||||
(1 row)
|
||||
|
@ -1,20 +0,0 @@
|
||||
-- Add to the search path the schema
|
||||
SET search_path TO public,cartodb,cdb_dataservices_client;
|
||||
-- Mock the server functions
|
||||
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_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_dataservices_client._cdb_geocode_ipaddress_point(3): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_ipaddress_point invoked with params (test_user, <NULL>, 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
|
||||
-----------------------------
|
||||
|
||||
(1 row)
|
||||
|
@ -1,101 +0,0 @@
|
||||
-- Add to the search path the schema
|
||||
SET search_path TO public,cartodb,cdb_dataservices_client;
|
||||
-- Mock the server functions
|
||||
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_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_dataservices_client._cdb_geocode_street_point(6): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_geocoder_street_point invoked with params (test_user, <NULL>, One street, 1, <NULL>, <NULL>, <NULL>)
|
||||
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
|
||||
--------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocode_street_point('One street', 'city');
|
||||
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, <NULL>, One street, city, <NULL>, <NULL>)
|
||||
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
|
||||
--------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocode_street_point('One street', 'city', 'state');
|
||||
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, <NULL>, One street, city, state, <NULL>)
|
||||
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
|
||||
--------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocode_street_point('One street', 'city', 'state', '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, <NULL>, 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
|
||||
--------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocode_street_point('One street', 'city', NULL, '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, <NULL>, One street, city, <NULL>, 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
|
||||
--------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocode_street_point('One street, 1');
|
||||
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, <NULL>, One street, 1, <NULL>, <NULL>, <NULL>)
|
||||
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
|
||||
--------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocode_street_point('One street', 'city');
|
||||
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, <NULL>, One street, city, <NULL>, <NULL>)
|
||||
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
|
||||
--------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocode_street_point('One street', 'city', 'state');
|
||||
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, <NULL>, One street, city, state, <NULL>)
|
||||
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
|
||||
--------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocode_street_point('One street', 'city', 'state', '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, <NULL>, 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
|
||||
--------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocode_street_point('One street', 'city', NULL, '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, <NULL>, One street, city, <NULL>, 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
|
||||
--------------------------
|
||||
|
||||
(1 row)
|
||||
|
@ -1,117 +0,0 @@
|
||||
-- Use regular user role
|
||||
SET ROLE test_regular_user;
|
||||
-- Add to the search path the schema
|
||||
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_dataservices_client._cdb_geocode_admin0_polygon(3): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_admin0_polygon invoked with params (test_user, <NULL>, 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
|
||||
----------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocode_admin1_polygon('California');
|
||||
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, <NULL>, 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
|
||||
----------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocode_admin1_polygon('California', 'United States');
|
||||
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, <NULL>, 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
|
||||
----------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocode_namedplace_point('Elx');
|
||||
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, <NULL>, 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
|
||||
------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocode_namedplace_point('Elx', 'Valencia');
|
||||
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, <NULL>, 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
|
||||
------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocode_namedplace_point('Elx', 'Valencia', 'Spain');
|
||||
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, <NULL>, 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
|
||||
------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocode_postalcode_polygon('03204', 'Spain');
|
||||
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, <NULL>, 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
|
||||
--------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocode_postalcode_point('03204', 'Spain');
|
||||
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, <NULL>, 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
|
||||
------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocode_ipaddress_point('8.8.8.8');
|
||||
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, <NULL>, 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
|
||||
-----------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocode_street_point('one street, 1');
|
||||
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, <NULL>, one street, 1, <NULL>, <NULL>, <NULL>)
|
||||
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
|
||||
--------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
-- Check the regular user has no permissions on private functions
|
||||
SELECT _cdb_geocode_admin0_polygon('evil_user', 'evil_orgname', 'Hell');
|
||||
ERROR: permission denied for function _cdb_geocode_admin0_polygon
|
||||
SELECT _cdb_geocode_admin1_polygon('evil_user', 'evil_orgname', 'Hell');
|
||||
ERROR: permission denied for function _cdb_geocode_admin1_polygon
|
||||
SELECT _cdb_geocode_admin1_polygon('evil_user', 'evil_orgname', 'Sheol', 'Hell');
|
||||
ERROR: permission denied for function _cdb_geocode_admin1_polygon
|
||||
SELECT _cdb_geocode_namedplace_point('evil_user', 'evil_orgname', 'Sheol');
|
||||
ERROR: permission denied for function _cdb_geocode_namedplace_point
|
||||
SELECT _cdb_geocode_namedplace_point('evil_user', 'evil_orgname', 'Sheol', 'Hell');
|
||||
ERROR: permission denied for function _cdb_geocode_namedplace_point
|
||||
SELECT _cdb_geocode_namedplace_point('evil_user', 'evil_orgname', 'Sheol', 'Hell', 'Ugly world');
|
||||
ERROR: permission denied for function _cdb_geocode_namedplace_point
|
||||
SELECT _cdb_geocode_postalcode_polygon('evil_user', 'evil_orgname', '66666', 'Hell');
|
||||
ERROR: permission denied for function _cdb_geocode_postalcode_polygon
|
||||
SELECT _cdb_geocode_postalcode_point('evil_user', 'evil_orgname', '66666', 'Hell');
|
||||
ERROR: permission denied for function _cdb_geocode_postalcode_point
|
||||
SELECT _cdb_geocode_ipaddress_point('evil_user', 'evil_orgname', '8.8.8.8');
|
||||
ERROR: permission denied for function _cdb_geocode_ipaddress_point
|
||||
SELECT _cdb_geocode_street_point('evil_user', 'evil_orgname', 'one street, 1');
|
||||
ERROR: permission denied for function _cdb_geocode_street_point
|
@ -1,23 +0,0 @@
|
||||
-- Install dependencies
|
||||
CREATE EXTENSION postgis;
|
||||
CREATE EXTENSION schema_triggers;
|
||||
CREATE EXTENSION plpythonu;
|
||||
CREATE EXTENSION cartodb;
|
||||
CREATE EXTENSION plproxy;
|
||||
|
||||
-- Install the extension
|
||||
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"}');
|
||||
-- Mock the user configuration
|
||||
SELECT cartodb.cdb_conf_setconf('user_config', '{"is_organization": false, "entity_name": "test_user"}');
|
||||
|
||||
-- Mock the server schema
|
||||
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_dataservices_client;
|
@ -1,15 +0,0 @@
|
||||
-- Add to the search path the schema
|
||||
SET search_path TO public,cartodb,cdb_dataservices_client;
|
||||
|
||||
-- Mock the server function
|
||||
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_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');
|
@ -1,24 +0,0 @@
|
||||
-- Add to the search path the schema
|
||||
SET search_path TO public,cartodb,cdb_dataservices_client;
|
||||
|
||||
-- Mock the server functions
|
||||
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_dataservices_server.cdb_geocode_admin1_polygon invoked with params (%, %, %)', username, orgname, admin1_name;
|
||||
RETURN NULL;
|
||||
END;
|
||||
$$ LANGUAGE 'plpgsql';
|
||||
|
||||
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_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');
|
||||
SELECT cdb_geocode_admin1_polygon('California', 'United States');
|
@ -1,33 +0,0 @@
|
||||
-- Add to the search path the schema
|
||||
SET search_path TO public,cartodb,cdb_dataservices_client;
|
||||
|
||||
-- Mock the server functions
|
||||
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_dataservices_server.cdb_geocode_namedplace_point invoked with params (%, %, %)', username, orgname, city_name;
|
||||
RETURN NULL;
|
||||
END;
|
||||
$$ LANGUAGE 'plpgsql';
|
||||
|
||||
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_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_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_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');
|
||||
SELECT cdb_geocode_namedplace_point('Elx', 'Spain');
|
||||
SELECT cdb_geocode_namedplace_point('Elx', 'Valencia', 'Spain');
|
||||
|
@ -1,23 +0,0 @@
|
||||
-- Add to the search path the schema
|
||||
SET search_path TO public,cartodb,cdb_dataservices_client;
|
||||
|
||||
-- Mock the server functions
|
||||
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_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_dataservices_server.cdb_geocode_postalcode_point(username text, orgname text, postal_code text, country_name text)
|
||||
RETURNS Geometry AS $$
|
||||
BEGIN
|
||||
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');
|
||||
SELECT cdb_geocode_postalcode_point('03204', 'Spain');
|
@ -1,15 +0,0 @@
|
||||
-- Add to the search path the schema
|
||||
SET search_path TO public,cartodb,cdb_dataservices_client;
|
||||
|
||||
-- Mock the server functions
|
||||
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_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');
|
@ -1,30 +0,0 @@
|
||||
-- Use regular user role
|
||||
SET ROLE test_regular_user;
|
||||
|
||||
-- Add to the search path the schema
|
||||
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');
|
||||
SELECT cdb_geocode_admin1_polygon('California');
|
||||
SELECT cdb_geocode_admin1_polygon('California', 'United States');
|
||||
SELECT cdb_geocode_namedplace_point('Elx');
|
||||
SELECT cdb_geocode_namedplace_point('Elx', 'Valencia');
|
||||
SELECT cdb_geocode_namedplace_point('Elx', 'Valencia', 'Spain');
|
||||
SELECT cdb_geocode_postalcode_polygon('03204', 'Spain');
|
||||
SELECT cdb_geocode_postalcode_point('03204', 'Spain');
|
||||
SELECT cdb_geocode_ipaddress_point('8.8.8.8');
|
||||
SELECT cdb_geocode_street_point('one street, 1');
|
||||
|
||||
-- Check the regular user has no permissions on private functions
|
||||
SELECT _cdb_geocode_admin0_polygon('evil_user', 'evil_orgname', 'Hell');
|
||||
SELECT _cdb_geocode_admin1_polygon('evil_user', 'evil_orgname', 'Hell');
|
||||
SELECT _cdb_geocode_admin1_polygon('evil_user', 'evil_orgname', 'Sheol', 'Hell');
|
||||
SELECT _cdb_geocode_namedplace_point('evil_user', 'evil_orgname', 'Sheol');
|
||||
SELECT _cdb_geocode_namedplace_point('evil_user', 'evil_orgname', 'Sheol', 'Hell');
|
||||
SELECT _cdb_geocode_namedplace_point('evil_user', 'evil_orgname', 'Sheol', 'Hell', 'Ugly world');
|
||||
SELECT _cdb_geocode_postalcode_polygon('evil_user', 'evil_orgname', '66666', 'Hell');
|
||||
SELECT _cdb_geocode_postalcode_point('evil_user', 'evil_orgname', '66666', 'Hell');
|
||||
SELECT _cdb_geocode_ipaddress_point('evil_user', 'evil_orgname', '8.8.8.8');
|
||||
SELECT _cdb_geocode_street_point('evil_user', 'evil_orgname', 'one street, 1');
|
@ -1,29 +0,0 @@
|
||||
-- Install dependencies
|
||||
CREATE EXTENSION postgis;
|
||||
CREATE EXTENSION schema_triggers;
|
||||
CREATE EXTENSION plpythonu;
|
||||
CREATE EXTENSION cartodb;
|
||||
CREATE EXTENSION plproxy;
|
||||
-- Install the extension
|
||||
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
|
||||
------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
-- Mock the user configuration
|
||||
SELECT cartodb.cdb_conf_setconf('user_config', '{"is_organization": false, "entity_name": "test_user"}');
|
||||
cdb_conf_setconf
|
||||
------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
-- Mock the server schema
|
||||
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_dataservices_client;
|
@ -1,117 +0,0 @@
|
||||
-- Use regular user role
|
||||
SET ROLE test_regular_user;
|
||||
-- Add to the search path the schema
|
||||
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_dataservices_client._cdb_geocode_admin0_polygon(3): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_admin0_polygon invoked with params (test_user, <NULL>, 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 16 at SQL statement
|
||||
cdb_geocode_admin0_polygon
|
||||
----------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocode_admin1_polygon('California');
|
||||
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, <NULL>, 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 16 at SQL statement
|
||||
cdb_geocode_admin1_polygon
|
||||
----------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocode_admin1_polygon('California', 'United States');
|
||||
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, <NULL>, 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 16 at SQL statement
|
||||
cdb_geocode_admin1_polygon
|
||||
----------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocode_namedplace_point('Elx');
|
||||
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, <NULL>, 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 16 at SQL statement
|
||||
cdb_geocode_namedplace_point
|
||||
------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocode_namedplace_point('Elx', 'Valencia');
|
||||
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, <NULL>, 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 16 at SQL statement
|
||||
cdb_geocode_namedplace_point
|
||||
------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocode_namedplace_point('Elx', 'Valencia', 'Spain');
|
||||
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, <NULL>, 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 16 at SQL statement
|
||||
cdb_geocode_namedplace_point
|
||||
------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocode_postalcode_polygon('03204', 'Spain');
|
||||
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, <NULL>, 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 16 at SQL statement
|
||||
cdb_geocode_postalcode_polygon
|
||||
--------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocode_postalcode_point('03204', 'Spain');
|
||||
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, <NULL>, 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 16 at SQL statement
|
||||
cdb_geocode_postalcode_point
|
||||
------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocode_ipaddress_point('8.8.8.8');
|
||||
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, <NULL>, 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 16 at SQL statement
|
||||
cdb_geocode_ipaddress_point
|
||||
-----------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT cdb_geocode_street_point('one street, 1');
|
||||
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, <NULL>, one street, 1, <NULL>, <NULL>, <NULL>)
|
||||
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 16 at SQL statement
|
||||
cdb_geocode_street_point
|
||||
--------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
-- Check the regular user has no permissions on private functions
|
||||
SELECT _cdb_geocode_admin0_polygon('evil_user', 'evil_orgname', 'Hell');
|
||||
ERROR: permission denied for function _cdb_geocode_admin0_polygon
|
||||
SELECT _cdb_geocode_admin1_polygon('evil_user', 'evil_orgname', 'Hell');
|
||||
ERROR: permission denied for function _cdb_geocode_admin1_polygon
|
||||
SELECT _cdb_geocode_admin1_polygon('evil_user', 'evil_orgname', 'Sheol', 'Hell');
|
||||
ERROR: permission denied for function _cdb_geocode_admin1_polygon
|
||||
SELECT _cdb_geocode_namedplace_point('evil_user', 'evil_orgname', 'Sheol');
|
||||
ERROR: permission denied for function _cdb_geocode_namedplace_point
|
||||
SELECT _cdb_geocode_namedplace_point('evil_user', 'evil_orgname', 'Sheol', 'Hell');
|
||||
ERROR: permission denied for function _cdb_geocode_namedplace_point
|
||||
SELECT _cdb_geocode_namedplace_point('evil_user', 'evil_orgname', 'Sheol', 'Hell', 'Ugly world');
|
||||
ERROR: permission denied for function _cdb_geocode_namedplace_point
|
||||
SELECT _cdb_geocode_postalcode_polygon('evil_user', 'evil_orgname', '66666', 'Hell');
|
||||
ERROR: permission denied for function _cdb_geocode_postalcode_polygon
|
||||
SELECT _cdb_geocode_postalcode_point('evil_user', 'evil_orgname', '66666', 'Hell');
|
||||
ERROR: permission denied for function _cdb_geocode_postalcode_point
|
||||
SELECT _cdb_geocode_ipaddress_point('evil_user', 'evil_orgname', '8.8.8.8');
|
||||
ERROR: permission denied for function _cdb_geocode_ipaddress_point
|
||||
SELECT _cdb_geocode_street_point('evil_user', 'evil_orgname', 'one street, 1');
|
||||
ERROR: permission denied for function _cdb_geocode_street_point
|
@ -1,23 +0,0 @@
|
||||
-- Install dependencies
|
||||
CREATE EXTENSION postgis;
|
||||
CREATE EXTENSION schema_triggers;
|
||||
CREATE EXTENSION plpythonu;
|
||||
CREATE EXTENSION cartodb;
|
||||
CREATE EXTENSION plproxy;
|
||||
|
||||
-- Install the extension
|
||||
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"}');
|
||||
-- Mock the user configuration
|
||||
SELECT cartodb.cdb_conf_setconf('user_config', '{"is_organization": false, "entity_name": "test_user"}');
|
||||
|
||||
-- Mock the server schema
|
||||
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_dataservices_client;
|
@ -1,15 +0,0 @@
|
||||
-- Add to the search path the schema
|
||||
SET search_path TO public,cartodb,cdb_dataservices_client;
|
||||
|
||||
-- Mock the server function
|
||||
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_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');
|
@ -1,24 +0,0 @@
|
||||
-- Add to the search path the schema
|
||||
SET search_path TO public,cartodb,cdb_dataservices_client;
|
||||
|
||||
-- Mock the server functions
|
||||
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_dataservices_server.cdb_geocode_admin1_polygon invoked with params (%, %, %)', username, orgname, admin1_name;
|
||||
RETURN NULL;
|
||||
END;
|
||||
$$ LANGUAGE 'plpgsql';
|
||||
|
||||
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_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');
|
||||
SELECT cdb_geocode_admin1_polygon('California', 'United States');
|
@ -1,33 +0,0 @@
|
||||
-- Add to the search path the schema
|
||||
SET search_path TO public,cartodb,cdb_dataservices_client;
|
||||
|
||||
-- Mock the server functions
|
||||
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_dataservices_server.cdb_geocode_namedplace_point invoked with params (%, %, %)', username, orgname, city_name;
|
||||
RETURN NULL;
|
||||
END;
|
||||
$$ LANGUAGE 'plpgsql';
|
||||
|
||||
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_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_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_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');
|
||||
SELECT cdb_geocode_namedplace_point('Elx', 'Spain');
|
||||
SELECT cdb_geocode_namedplace_point('Elx', 'Valencia', 'Spain');
|
||||
|
@ -1,23 +0,0 @@
|
||||
-- Add to the search path the schema
|
||||
SET search_path TO public,cartodb,cdb_dataservices_client;
|
||||
|
||||
-- Mock the server functions
|
||||
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_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_dataservices_server.cdb_geocode_postalcode_point(username text, orgname text, postal_code text, country_name text)
|
||||
RETURNS Geometry AS $$
|
||||
BEGIN
|
||||
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');
|
||||
SELECT cdb_geocode_postalcode_point('03204', 'Spain');
|
@ -1,15 +0,0 @@
|
||||
-- Add to the search path the schema
|
||||
SET search_path TO public,cartodb,cdb_dataservices_client;
|
||||
|
||||
-- Mock the server functions
|
||||
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_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');
|
@ -1,24 +0,0 @@
|
||||
-- Add to the search path the schema
|
||||
SET search_path TO public,cartodb,cdb_dataservices_client;
|
||||
|
||||
-- Mock the server functions
|
||||
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_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');
|
||||
SELECT cdb_geocode_street_point('One street', 'city');
|
||||
SELECT cdb_geocode_street_point('One street', 'city', 'state');
|
||||
SELECT cdb_geocode_street_point('One street', 'city', 'state', 'country');
|
||||
SELECT cdb_geocode_street_point('One street', 'city', NULL, 'country');
|
||||
SELECT cdb_geocode_street_point('One street, 1');
|
||||
SELECT cdb_geocode_street_point('One street', 'city');
|
||||
SELECT cdb_geocode_street_point('One street', 'city', 'state');
|
||||
SELECT cdb_geocode_street_point('One street', 'city', 'state', 'country');
|
||||
SELECT cdb_geocode_street_point('One street', 'city', NULL, 'country');
|
@ -1,30 +0,0 @@
|
||||
-- Use regular user role
|
||||
SET ROLE test_regular_user;
|
||||
|
||||
-- Add to the search path the schema
|
||||
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');
|
||||
SELECT cdb_geocode_admin1_polygon('California');
|
||||
SELECT cdb_geocode_admin1_polygon('California', 'United States');
|
||||
SELECT cdb_geocode_namedplace_point('Elx');
|
||||
SELECT cdb_geocode_namedplace_point('Elx', 'Valencia');
|
||||
SELECT cdb_geocode_namedplace_point('Elx', 'Valencia', 'Spain');
|
||||
SELECT cdb_geocode_postalcode_polygon('03204', 'Spain');
|
||||
SELECT cdb_geocode_postalcode_point('03204', 'Spain');
|
||||
SELECT cdb_geocode_ipaddress_point('8.8.8.8');
|
||||
SELECT cdb_geocode_street_point('one street, 1');
|
||||
|
||||
-- Check the regular user has no permissions on private functions
|
||||
SELECT _cdb_geocode_admin0_polygon('evil_user', 'evil_orgname', 'Hell');
|
||||
SELECT _cdb_geocode_admin1_polygon('evil_user', 'evil_orgname', 'Hell');
|
||||
SELECT _cdb_geocode_admin1_polygon('evil_user', 'evil_orgname', 'Sheol', 'Hell');
|
||||
SELECT _cdb_geocode_namedplace_point('evil_user', 'evil_orgname', 'Sheol');
|
||||
SELECT _cdb_geocode_namedplace_point('evil_user', 'evil_orgname', 'Sheol', 'Hell');
|
||||
SELECT _cdb_geocode_namedplace_point('evil_user', 'evil_orgname', 'Sheol', 'Hell', 'Ugly world');
|
||||
SELECT _cdb_geocode_postalcode_polygon('evil_user', 'evil_orgname', '66666', 'Hell');
|
||||
SELECT _cdb_geocode_postalcode_point('evil_user', 'evil_orgname', '66666', 'Hell');
|
||||
SELECT _cdb_geocode_ipaddress_point('evil_user', 'evil_orgname', '8.8.8.8');
|
||||
SELECT _cdb_geocode_street_point('evil_user', 'evil_orgname', 'one street, 1');
|
@ -1 +0,0 @@
|
||||
../../0.2.0/expected/00_installation_test.out
|
@ -1 +0,0 @@
|
||||
../../0.2.0/expected/10_admin0_test.out
|
@ -1 +0,0 @@
|
||||
../../0.2.0/expected/20_admin1_test.out
|
@ -1 +0,0 @@
|
||||
../../0.2.0/expected/30_namedplaces_test.out
|
@ -1 +0,0 @@
|
||||
../../0.2.0/expected/40_postalcodes_test.out
|
@ -1 +0,0 @@
|
||||
../../0.2.0/expected/50_ipaddresses_test.out
|
@ -1 +0,0 @@
|
||||
../../0.2.0/expected/60_street_test.out
|
@ -1 +0,0 @@
|
||||
../../0.2.0/sql/00_installation_test.sql
|
@ -1 +0,0 @@
|
||||
../../0.2.0/sql/10_admin0_test.sql
|
@ -1 +0,0 @@
|
||||
../../0.2.0/sql/20_admin1_test.sql
|
@ -1 +0,0 @@
|
||||
../../0.2.0/sql/30_namedplaces_test.sql
|
@ -1 +0,0 @@
|
||||
../../0.2.0/sql/40_postalcodes_test.sql
|
@ -1 +0,0 @@
|
||||
../../0.2.0/sql/50_ipaddresses_test.sql
|
@ -1 +0,0 @@
|
||||
../../0.2.0/sql/60_street_test.sql
|
Loading…
Reference in New Issue
Block a user