Fixing adm0 plural naming and cdb typos in NOTICE messages

This commit is contained in:
Carla Iriberri 2015-11-17 11:30:25 +01:00
parent 30c02dd053
commit 199a7ed905
8 changed files with 41 additions and 41 deletions

View File

@ -1,18 +1,18 @@
-- Mock the server function
CREATE OR REPLACE FUNCTION cdb_geocoder_server.geocode_admin0_polygons(user_id name, tx_id bigint, country_name text)
CREATE OR REPLACE FUNCTION cdb_geocoder_server.geocode_admin0_polygon(user_id name, tx_id bigint, country_name text)
RETURNS Geometry AS $$
BEGIN
RAISE NOTICE 'cbd_geocoder_server.geocode_admin0_polygons invoked with params (%, %, %)', user_id, 'some_transaction_id', country_name;
RAISE NOTICE 'cdb_geocoder_server.geocode_admin0_polygon invoked with params (%, %, %)', user_id, 'some_transaction_id', country_name;
RETURN NULL;
END;
$$ LANGUAGE 'plpgsql';
-- Exercise the public and the proxied function
SELECT cdb_geocoder_client.geocode_admin0_polygons('Spain');
NOTICE: cdb_geocoder_client._geocode_admin0_polygons(3): [contrib_regression] REMOTE NOTICE: cbd_geocoder_server.geocode_admin0_polygons invoked with params (postgres, some_transaction_id, Spain)
CONTEXT: SQL statement "SELECT cdb_geocoder_client._geocode_admin0_polygons(session_user, txid_current(), country_name)"
PL/pgSQL function cdb_geocoder_client.geocode_admin0_polygons(text) line 5 at SQL statement
geocode_admin0_polygons
-------------------------
SELECT cdb_geocoder_client.geocode_admin0_polygon('Spain');
NOTICE: cdb_geocoder_client._geocode_admin0_polygon(3): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.geocode_admin0_polygon invoked with params (postgres, some_transaction_id, Spain)
CONTEXT: SQL statement "SELECT cdb_geocoder_client._geocode_admin0_polygon(session_user, txid_current(), country_name)"
PL/pgSQL function cdb_geocoder_client.geocode_admin0_polygon(text) line 5 at SQL statement
geocode_admin0_polygon
------------------------
(1 row)

View File

@ -2,20 +2,20 @@
CREATE OR REPLACE FUNCTION cdb_geocoder_server.geocode_admin1_polygon(user_id name, tx_id bigint, admin1_name text)
RETURNS Geometry AS $$
BEGIN
RAISE NOTICE 'cbd_geocoder_server.geocode_admin1_polygon invoked with params (%, %, %)', user_id, 'some_transaction_id', admin1_name;
RAISE NOTICE 'cdb_geocoder_server.geocode_admin1_polygon invoked with params (%, %, %)', user_id, 'some_transaction_id', admin1_name;
RETURN NULL;
END;
$$ LANGUAGE 'plpgsql';
CREATE OR REPLACE FUNCTION cdb_geocoder_server.geocode_admin1_polygon(user_id name, tx_id bigint, admin1_name text, country_name text)
RETURNS Geometry AS $$
BEGIN
RAISE NOTICE 'cbd_geocoder_server.geocode_admin1_polygon invoked with params (%, %, %, %)', user_id, 'some_transaction_id', admin1_name, country_name;
RAISE NOTICE 'cdb_geocoder_server.geocode_admin1_polygon invoked with params (%, %, %, %)', user_id, 'some_transaction_id', admin1_name, country_name;
RETURN NULL;
END;
$$ LANGUAGE 'plpgsql';
-- Exercise the public and the proxied function
SELECT cdb_geocoder_client.geocode_admin1_polygon('California');
NOTICE: cdb_geocoder_client._geocode_admin1_polygon(3): [contrib_regression] REMOTE NOTICE: cbd_geocoder_server.geocode_admin1_polygon invoked with params (postgres, some_transaction_id, California)
NOTICE: cdb_geocoder_client._geocode_admin1_polygon(3): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.geocode_admin1_polygon invoked with params (postgres, some_transaction_id, California)
CONTEXT: SQL statement "SELECT cdb_geocoder_client._geocode_admin1_polygon(session_user, txid_current(), admin1_name)"
PL/pgSQL function cdb_geocoder_client.geocode_admin1_polygon(text) line 5 at SQL statement
geocode_admin1_polygon
@ -24,7 +24,7 @@ PL/pgSQL function cdb_geocoder_client.geocode_admin1_polygon(text) line 5 at SQL
(1 row)
SELECT cdb_geocoder_client.geocode_admin1_polygon('California', 'United States');
NOTICE: cdb_geocoder_client._geocode_admin1_polygon(4): [contrib_regression] REMOTE NOTICE: cbd_geocoder_server.geocode_admin1_polygon invoked with params (postgres, some_transaction_id, California, United States)
NOTICE: cdb_geocoder_client._geocode_admin1_polygon(4): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.geocode_admin1_polygon invoked with params (postgres, some_transaction_id, California, United States)
CONTEXT: SQL statement "SELECT cdb_geocoder_client._geocode_admin1_polygon(session_user, txid_current(), admin1_name, country_name)"
PL/pgSQL function cdb_geocoder_client.geocode_admin1_polygon(text,text) line 5 at SQL statement
geocode_admin1_polygon

View File

@ -2,27 +2,27 @@
CREATE OR REPLACE FUNCTION cdb_geocoder_server.geocode_namedplace_point(user_id name, tx_id bigint, city_name text)
RETURNS Geometry AS $$
BEGIN
RAISE NOTICE 'cbd_geocoder_server.geocode_namedplace_point invoked with params (%, %, %)', user_id, 'some_transaction_id', city_name;
RAISE NOTICE 'cdb_geocoder_server.geocode_namedplace_point invoked with params (%, %, %)', user_id, 'some_transaction_id', city_name;
RETURN NULL;
END;
$$ LANGUAGE 'plpgsql';
CREATE OR REPLACE FUNCTION cdb_geocoder_server.geocode_namedplace_point(user_id name, tx_id bigint, city_name text, country_name text)
RETURNS Geometry AS $$
BEGIN
RAISE NOTICE 'cbd_geocoder_server.geocode_namedplace_point invoked with params (%, %, %, %)', user_id, 'some_transaction_id', city_name, country_name;
RAISE NOTICE 'cdb_geocoder_server.geocode_namedplace_point invoked with params (%, %, %, %)', user_id, 'some_transaction_id', city_name, country_name;
RETURN NULL;
END;
$$ LANGUAGE 'plpgsql';
CREATE OR REPLACE FUNCTION cdb_geocoder_server.geocode_namedplace_point(user_id name, tx_id bigint, city_name text, admin1_name text, country_name text)
RETURNS Geometry AS $$
BEGIN
RAISE NOTICE 'cbd_geocoder_server.geocode_namedplace_point invoked with params (%, %, %, %, %)', user_id, 'some_transaction_id', city_name, admin1_name, country_name;
RAISE NOTICE 'cdb_geocoder_server.geocode_namedplace_point invoked with params (%, %, %, %, %)', user_id, 'some_transaction_id', city_name, admin1_name, country_name;
RETURN NULL;
END;
$$ LANGUAGE 'plpgsql';
-- Exercise the public and the proxied function
SELECT cdb_geocoder_client.geocode_namedplace_point('Elx');
NOTICE: cdb_geocoder_client._geocode_namedplace_point(3): [contrib_regression] REMOTE NOTICE: cbd_geocoder_server.geocode_namedplace_point invoked with params (postgres, some_transaction_id, Elx)
NOTICE: cdb_geocoder_client._geocode_namedplace_point(3): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.geocode_namedplace_point invoked with params (postgres, some_transaction_id, Elx)
CONTEXT: SQL statement "SELECT cdb_geocoder_client._geocode_namedplace_point(session_user, txid_current(), city_name)"
PL/pgSQL function cdb_geocoder_client.geocode_namedplace_point(text) line 5 at SQL statement
geocode_namedplace_point
@ -31,7 +31,7 @@ PL/pgSQL function cdb_geocoder_client.geocode_namedplace_point(text) line 5 at S
(1 row)
SELECT cdb_geocoder_client.geocode_namedplace_point('Elx', 'Spain');
NOTICE: cdb_geocoder_client._geocode_namedplace_point(4): [contrib_regression] REMOTE NOTICE: cbd_geocoder_server.geocode_namedplace_point invoked with params (postgres, some_transaction_id, Elx, Spain)
NOTICE: cdb_geocoder_client._geocode_namedplace_point(4): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.geocode_namedplace_point invoked with params (postgres, some_transaction_id, Elx, Spain)
CONTEXT: SQL statement "SELECT cdb_geocoder_client._geocode_namedplace_point(session_user, txid_current(), city_name, country_name)"
PL/pgSQL function cdb_geocoder_client.geocode_namedplace_point(text,text) line 5 at SQL statement
geocode_namedplace_point
@ -40,7 +40,7 @@ PL/pgSQL function cdb_geocoder_client.geocode_namedplace_point(text,text) line 5
(1 row)
SELECT cdb_geocoder_client.geocode_namedplace_point('Elx', 'Valencia', 'Spain');
NOTICE: cdb_geocoder_client._geocode_namedplace_point(5): [contrib_regression] REMOTE NOTICE: cbd_geocoder_server.geocode_namedplace_point invoked with params (postgres, some_transaction_id, Elx, Valencia, Spain)
NOTICE: cdb_geocoder_client._geocode_namedplace_point(5): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.geocode_namedplace_point invoked with params (postgres, some_transaction_id, Elx, Valencia, Spain)
CONTEXT: SQL statement "SELECT cdb_geocoder_client._geocode_namedplace_point(session_user, txid_current(), city_name, admin1_name, country_name)"
PL/pgSQL function cdb_geocoder_client.geocode_namedplace_point(text,text,text) line 5 at SQL statement
geocode_namedplace_point

View File

@ -2,17 +2,17 @@
SET ROLE test_regular_user;
-- Exercise the public function
-- it is public, it shall work
SELECT cdb_geocoder_client.geocode_admin0_polygons('Spain');
NOTICE: cdb_geocoder_client._geocode_admin0_polygons(3): [contrib_regression] REMOTE NOTICE: cbd_geocoder_server.geocode_admin0_polygons invoked with params (postgres, some_transaction_id, Spain)
CONTEXT: SQL statement "SELECT cdb_geocoder_client._geocode_admin0_polygons(session_user, txid_current(), country_name)"
PL/pgSQL function cdb_geocoder_client.geocode_admin0_polygons(text) line 5 at SQL statement
geocode_admin0_polygons
-------------------------
SELECT cdb_geocoder_client.geocode_admin0_polygon('Spain');
NOTICE: cdb_geocoder_client._geocode_admin0_polygon(3): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.geocode_admin0_polygon invoked with params (postgres, some_transaction_id, Spain)
CONTEXT: SQL statement "SELECT cdb_geocoder_client._geocode_admin0_polygon(session_user, txid_current(), country_name)"
PL/pgSQL function cdb_geocoder_client.geocode_admin0_polygon(text) line 5 at SQL statement
geocode_admin0_polygon
------------------------
(1 row)
SELECT cdb_geocoder_client.geocode_admin1_polygon('California');
NOTICE: cdb_geocoder_client._geocode_admin1_polygon(3): [contrib_regression] REMOTE NOTICE: cbd_geocoder_server.geocode_admin1_polygon invoked with params (postgres, some_transaction_id, California)
NOTICE: cdb_geocoder_client._geocode_admin1_polygon(3): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.geocode_admin1_polygon invoked with params (postgres, some_transaction_id, California)
CONTEXT: SQL statement "SELECT cdb_geocoder_client._geocode_admin1_polygon(session_user, txid_current(), admin1_name)"
PL/pgSQL function cdb_geocoder_client.geocode_admin1_polygon(text) line 5 at SQL statement
geocode_admin1_polygon
@ -21,7 +21,7 @@ PL/pgSQL function cdb_geocoder_client.geocode_admin1_polygon(text) line 5 at SQL
(1 row)
SELECT cdb_geocoder_client.geocode_admin1_polygon('California', 'United States');
NOTICE: cdb_geocoder_client._geocode_admin1_polygon(4): [contrib_regression] REMOTE NOTICE: cbd_geocoder_server.geocode_admin1_polygon invoked with params (postgres, some_transaction_id, California, United States)
NOTICE: cdb_geocoder_client._geocode_admin1_polygon(4): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.geocode_admin1_polygon invoked with params (postgres, some_transaction_id, California, United States)
CONTEXT: SQL statement "SELECT cdb_geocoder_client._geocode_admin1_polygon(session_user, txid_current(), admin1_name, country_name)"
PL/pgSQL function cdb_geocoder_client.geocode_admin1_polygon(text,text) line 5 at SQL statement
geocode_admin1_polygon
@ -30,7 +30,7 @@ PL/pgSQL function cdb_geocoder_client.geocode_admin1_polygon(text,text) line 5 a
(1 row)
SELECT cdb_geocoder_client.geocode_namedplace_point('Elx');
NOTICE: cdb_geocoder_client._geocode_namedplace_point(3): [contrib_regression] REMOTE NOTICE: cbd_geocoder_server.geocode_namedplace_point invoked with params (postgres, some_transaction_id, Elx)
NOTICE: cdb_geocoder_client._geocode_namedplace_point(3): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.geocode_namedplace_point invoked with params (postgres, some_transaction_id, Elx)
CONTEXT: SQL statement "SELECT cdb_geocoder_client._geocode_namedplace_point(session_user, txid_current(), city_name)"
PL/pgSQL function cdb_geocoder_client.geocode_namedplace_point(text) line 5 at SQL statement
geocode_namedplace_point
@ -39,7 +39,7 @@ PL/pgSQL function cdb_geocoder_client.geocode_namedplace_point(text) line 5 at S
(1 row)
SELECT cdb_geocoder_client.geocode_namedplace_point('Elx', 'Valencia');
NOTICE: cdb_geocoder_client._geocode_namedplace_point(4): [contrib_regression] REMOTE NOTICE: cbd_geocoder_server.geocode_namedplace_point invoked with params (postgres, some_transaction_id, Elx, Valencia)
NOTICE: cdb_geocoder_client._geocode_namedplace_point(4): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.geocode_namedplace_point invoked with params (postgres, some_transaction_id, Elx, Valencia)
CONTEXT: SQL statement "SELECT cdb_geocoder_client._geocode_namedplace_point(session_user, txid_current(), city_name, country_name)"
PL/pgSQL function cdb_geocoder_client.geocode_namedplace_point(text,text) line 5 at SQL statement
geocode_namedplace_point
@ -48,7 +48,7 @@ PL/pgSQL function cdb_geocoder_client.geocode_namedplace_point(text,text) line 5
(1 row)
SELECT cdb_geocoder_client.geocode_namedplace_point('Elx', 'Valencia', 'Spain');
NOTICE: cdb_geocoder_client._geocode_namedplace_point(5): [contrib_regression] REMOTE NOTICE: cbd_geocoder_server.geocode_namedplace_point invoked with params (postgres, some_transaction_id, Elx, Valencia, Spain)
NOTICE: cdb_geocoder_client._geocode_namedplace_point(5): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.geocode_namedplace_point invoked with params (postgres, some_transaction_id, Elx, Valencia, Spain)
CONTEXT: SQL statement "SELECT cdb_geocoder_client._geocode_namedplace_point(session_user, txid_current(), city_name, admin1_name, country_name)"
PL/pgSQL function cdb_geocoder_client.geocode_namedplace_point(text,text,text) line 5 at SQL statement
geocode_namedplace_point
@ -84,8 +84,8 @@ PL/pgSQL function cdb_geocoder_client.geocode_ip(text) line 5 at SQL statement
(1 row)
-- Check the regular user has no permissions on private functions
SELECT cdb_geocoder_client._geocode_admin0_polygons('evil_user', 666, 'Hell');
ERROR: permission denied for function _geocode_admin0_polygons
SELECT cdb_geocoder_client._geocode_admin0_polygon('evil_user', 666, 'Hell');
ERROR: permission denied for function _geocode_admin0_polygon
SELECT cdb_geocoder_client._geocode_admin1_polygon('evil_user', 666, 'Hell');
ERROR: permission denied for function _geocode_admin1_polygon
SELECT cdb_geocoder_client._geocode_admin1_polygon('evil_user', 666, 'Sheol', 'Hell');

View File

@ -4,12 +4,12 @@
-- 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.geocode_admin0_polygons(country_name text)
CREATE OR REPLACE FUNCTION cdb_geocoder_client.geocode_admin0_polygon(country_name text)
RETURNS Geometry AS $$
DECLARE
ret Geometry;
BEGIN
SELECT cdb_geocoder_client._geocode_admin0_polygons(session_user, txid_current(), country_name) INTO ret;
SELECT cdb_geocoder_client._geocode_admin0_polygon(session_user, txid_current(), country_name) INTO ret;
RETURN ret;
END;
$$ LANGUAGE 'plpgsql' SECURITY DEFINER;
@ -19,8 +19,8 @@ $$ LANGUAGE 'plpgsql' SECURITY DEFINER;
--------------------------------------------------------------------------------
CREATE OR REPLACE FUNCTION cdb_geocoder_client._geocode_admin0_polygons(user_id name, tx_id bigint, country_name text)
CREATE OR REPLACE FUNCTION cdb_geocoder_client._geocode_admin0_polygon(user_id name, tx_id bigint, country_name text)
RETURNS Geometry AS $$
CONNECT cdb_geocoder_client._server_conn_str();
SELECT cdb_geocoder_server.geocode_admin0_polygons(user_id, tx_id, country_name);
SELECT cdb_geocoder_server.geocode_admin0_polygon(user_id, tx_id, country_name);
$$ LANGUAGE plproxy;

View File

@ -12,7 +12,7 @@ REVOKE EXECUTE ON ALL FUNCTIONS IN SCHEMA cdb_geocoder_client FROM PUBLIC, publi
-- Explicitly grant permissions to public functions
-- NOTE: All public functions must be listed below, grating permissions to publicuser
GRANT EXECUTE ON FUNCTION cdb_geocoder_client.geocode_admin0_polygons(country_name text) TO publicuser;
GRANT EXECUTE ON FUNCTION cdb_geocoder_client.geocode_admin0_polygon(country_name text) TO publicuser;
GRANT EXECUTE ON FUNCTION cdb_geocoder_client.geocode_admin1_polygon(admin1_name text) TO publicuser;
GRANT EXECUTE ON FUNCTION cdb_geocoder_client.geocode_admin1_polygon(admin1_name text, country_name text) TO publicuser;
GRANT EXECUTE ON FUNCTION cdb_geocoder_client.geocode_namedplace_point(city_name text) TO publicuser;

View File

@ -1,12 +1,12 @@
-- Mock the server function
CREATE OR REPLACE FUNCTION cdb_geocoder_server.geocode_admin0_polygons(user_id name, tx_id bigint, country_name text)
CREATE OR REPLACE FUNCTION cdb_geocoder_server.geocode_admin0_polygon(user_id name, tx_id bigint, country_name text)
RETURNS Geometry AS $$
BEGIN
RAISE NOTICE 'cdb_geocoder_server.geocode_admin0_polygons invoked with params (%, %, %)', user_id, 'some_transaction_id', country_name;
RAISE NOTICE 'cdb_geocoder_server.geocode_admin0_polygon invoked with params (%, %, %)', user_id, 'some_transaction_id', country_name;
RETURN NULL;
END;
$$ LANGUAGE 'plpgsql';
-- Exercise the public and the proxied function
SELECT cdb_geocoder_client.geocode_admin0_polygons('Spain');
SELECT cdb_geocoder_client.geocode_admin0_polygon('Spain');

View File

@ -3,7 +3,7 @@ SET ROLE test_regular_user;
-- Exercise the public function
-- it is public, it shall work
SELECT cdb_geocoder_client.geocode_admin0_polygons('Spain');
SELECT cdb_geocoder_client.geocode_admin0_polygon('Spain');
SELECT cdb_geocoder_client.geocode_admin1_polygon('California');
SELECT cdb_geocoder_client.geocode_admin1_polygon('California', 'United States');
SELECT cdb_geocoder_client.geocode_namedplace_point('Elx');
@ -14,7 +14,7 @@ SELECT cdb_geocoder_client.geocode_postalcode_point('03204', 'Spain');
SELECT cdb_geocoder_client.geocode_ip('8.8.8.8');
-- Check the regular user has no permissions on private functions
SELECT cdb_geocoder_client._geocode_admin0_polygons('evil_user', 666, 'Hell');
SELECT cdb_geocoder_client._geocode_admin0_polygon('evil_user', 666, 'Hell');
SELECT cdb_geocoder_client._geocode_admin1_polygon('evil_user', 666, 'Hell');
SELECT cdb_geocoder_client._geocode_admin1_polygon('evil_user', 666, 'Sheol', 'Hell');
SELECT cdb_geocoder_client._geocode_namedplace_point('evil_user', 666, 'Sheol');