2015-11-17 23:28:33 +08:00
|
|
|
--
|
|
|
|
-- Public geocoder API function
|
|
|
|
--
|
|
|
|
-- These are the only ones with permissions to publicuser role
|
|
|
|
-- and should also be the only ones with SECURITY DEFINER
|
|
|
|
|
2015-11-19 01:38:06 +08:00
|
|
|
CREATE OR REPLACE FUNCTION <%= GEOCODER_CLIENT_SCHEMA %>.<%= name %> (<%= params_with_type %>)
|
|
|
|
RETURNS <%= return_type %> AS $$
|
2015-11-17 23:28:33 +08:00
|
|
|
DECLARE
|
2015-11-19 01:38:06 +08:00
|
|
|
ret <%= return_type %>;
|
2015-11-23 20:09:03 +08:00
|
|
|
user_config json;
|
|
|
|
geocoder_config json;
|
2015-11-17 23:28:33 +08:00
|
|
|
BEGIN
|
2015-11-23 20:09:03 +08:00
|
|
|
SELECT cartodb.CDB_Conf_GetConf('<%= user_config_key %>') INTO user_config;
|
|
|
|
SELECT cartodb.CDB_Conf_GetConf('<%= geocoder_config_key %>') INTO geocoder_config;
|
2015-11-20 17:51:19 +08:00
|
|
|
SELECT <%= GEOCODER_CLIENT_SCHEMA %>._<%= name %>(session_user, user_config, geocoder_config, <%= params %>) INTO ret;
|
2015-11-17 23:28:33 +08:00
|
|
|
RETURN ret;
|
|
|
|
END;
|
|
|
|
$$ LANGUAGE 'plpgsql' SECURITY DEFINER;
|
|
|
|
|