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-18 00:39:15 +08:00
|
|
|
CREATE OR REPLACE FUNCTION <%= GEOCODER_CLIENT_SCHEMA %>.<%= signature['function_name'] %> (<%= signature['argument_data_types'] %>)
|
|
|
|
RETURNS <%= signature['result_data_type'] %> AS $$
|
2015-11-17 23:28:33 +08:00
|
|
|
DECLARE
|
2015-11-18 00:39:15 +08:00
|
|
|
ret <%= signature['result_data_type'] %>;
|
2015-11-17 23:28:33 +08:00
|
|
|
BEGIN
|
|
|
|
-- TODO: this is to be changed according to the feature doc
|
2015-11-18 00:39:15 +08:00
|
|
|
SELECT <%= GEOCODER_CLIENT_SCHEMA %>._geocode_admin0_polygon(session_user, txid_current(), <%= signature['argument_data_types'] %>) INTO ret;
|
2015-11-17 23:28:33 +08:00
|
|
|
RETURN ret;
|
|
|
|
END;
|
|
|
|
$$ LANGUAGE 'plpgsql' SECURITY DEFINER;
|
|
|
|
|