From 1842ba00e80238dd9bf417c26818dfc7b2b847c7 Mon Sep 17 00:00:00 2001 From: Rafa de la Torre Date: Tue, 17 Nov 2015 15:03:19 +0000 Subject: [PATCH 01/13] Interface definition in CSV --- interface/interface.csv | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 interface/interface.csv diff --git a/interface/interface.csv b/interface/interface.csv new file mode 100644 index 0000000..f8171e1 --- /dev/null +++ b/interface/interface.csv @@ -0,0 +1,10 @@ +function_name,result_data_type,argument_data_types +geocode_admin0_polygon,Geometry,"country_name text" +geocode_admin1_polygon,Geometry,"admin1_name text" +geocode_admin1_polygon,Geometry,"admin1_name text, country_name text" +geocode_namedplace_point,Geometry,"city_name text" +geocode_namedplace_point,Geometry,"city_name text, country_name text" +geocode_namedplace_point,Geometry,"city_name text, admin1_name text, country_name text" +geocode_postalcode_polygon,Geometry,"postal_code text, country_name text" +geocode_postalcode_point,Geometry,"postal_code text, country_name text" +geocode_ipaddress_point,Geometry,"ip_address text" From 584a76b927131abe245118f5a535b2a703117aba Mon Sep 17 00:00:00 2001 From: Rafa de la Torre Date: Tue, 17 Nov 2015 15:03:31 +0000 Subject: [PATCH 02/13] Small script to generate a bit of SQL from the interface --- interface/generate-grant-execute.rb | 32 +++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 interface/generate-grant-execute.rb diff --git a/interface/generate-grant-execute.rb b/interface/generate-grant-execute.rb new file mode 100644 index 0000000..3f7f8bf --- /dev/null +++ b/interface/generate-grant-execute.rb @@ -0,0 +1,32 @@ +#!/usr/bin/env ruby + +# A script to automatically generate SQL files from an interface definition. + +require 'csv' +require 'erb' + +GEOCODER_CLIENT_SCHEMA = 'cdb_geocoder_client' +INTERFACE_SOURCE_FILE = 'interface.csv' + +class GrantExecute + TEMPLATE=<<-END +GRANT EXECUTE ON FUNCTION <%= GEOCODER_CLIENT_SCHEMA %>.<%= function_signature['function_name'] %>(<%= function_signature['argument_data_types'] %>) TO publicuser; +END + + attr_reader :function_signature + + def initialize(function_signature) + @function_signature = function_signature + end + + def render + ERB.new(TEMPLATE).result(binding) + end +end + + + +CSV.foreach(INTERFACE_SOURCE_FILE, {headers: true}) do |function_signature| + grant = GrantExecute.new(function_signature).render + puts grant +end From 0f953dd5b6655498b2a23f6d8995f1d6d45c2ccd Mon Sep 17 00:00:00 2001 From: Rafa de la Torre Date: Tue, 17 Nov 2015 16:14:26 +0100 Subject: [PATCH 03/13] Move template to external file --- interface/generate-grant-execute.rb | 7 +++---- interface/templates/grant-execute.erb | 1 + 2 files changed, 4 insertions(+), 4 deletions(-) create mode 100644 interface/templates/grant-execute.erb diff --git a/interface/generate-grant-execute.rb b/interface/generate-grant-execute.rb index 3f7f8bf..b572723 100644 --- a/interface/generate-grant-execute.rb +++ b/interface/generate-grant-execute.rb @@ -9,18 +9,17 @@ GEOCODER_CLIENT_SCHEMA = 'cdb_geocoder_client' INTERFACE_SOURCE_FILE = 'interface.csv' class GrantExecute - TEMPLATE=<<-END -GRANT EXECUTE ON FUNCTION <%= GEOCODER_CLIENT_SCHEMA %>.<%= function_signature['function_name'] %>(<%= function_signature['argument_data_types'] %>) TO publicuser; -END + TEMPLATE_FILE = 'templates/grant-execute.erb' attr_reader :function_signature def initialize(function_signature) @function_signature = function_signature + @template = File.read(TEMPLATE_FILE) end def render - ERB.new(TEMPLATE).result(binding) + ERB.new(@template).result(binding) end end diff --git a/interface/templates/grant-execute.erb b/interface/templates/grant-execute.erb new file mode 100644 index 0000000..c3aaecb --- /dev/null +++ b/interface/templates/grant-execute.erb @@ -0,0 +1 @@ +GRANT EXECUTE ON FUNCTION <%= GEOCODER_CLIENT_SCHEMA %>.<%= function_signature['function_name'] %>(<%= function_signature['argument_data_types'] %>) TO publicuser; \ No newline at end of file From e0259a8b8c2a5b4544b8823f269d8d7ed6b2ff52 Mon Sep 17 00:00:00 2001 From: Rafa de la Torre Date: Tue, 17 Nov 2015 16:28:33 +0100 Subject: [PATCH 04/13] Add code generator for public API function definitions and their plproxied counterparts --- interface/generate-grant-execute.rb | 21 +++++++++++++++- .../templates/public-function-definition.erb | 24 +++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 interface/templates/public-function-definition.erb diff --git a/interface/generate-grant-execute.rb b/interface/generate-grant-execute.rb index b572723..2cb001f 100644 --- a/interface/generate-grant-execute.rb +++ b/interface/generate-grant-execute.rb @@ -23,9 +23,28 @@ class GrantExecute end end +class PublicFunctionDefinition + TEMPLATE_FILE = 'templates/public-function-definition.erb' + + attr_reader :function_signature + + def initialize(function_signature) + @function_signature = function_signature + @template = File.read(TEMPLATE_FILE) + end + + def render + ERB.new(@template).result(binding) + end +end CSV.foreach(INTERFACE_SOURCE_FILE, {headers: true}) do |function_signature| + + function_definition = PublicFunctionDefinition.new(function_signature).render + puts function_definition + + grant = GrantExecute.new(function_signature).render - puts grant + #puts grant end diff --git a/interface/templates/public-function-definition.erb b/interface/templates/public-function-definition.erb new file mode 100644 index 0000000..8bef626 --- /dev/null +++ b/interface/templates/public-function-definition.erb @@ -0,0 +1,24 @@ +-- +-- Public geocoder API function +-- +-- These are the only ones with permissions to publicuser role +-- and should also be the only ones with SECURITY DEFINER + +CREATE OR REPLACE FUNCTION <%= GEOCODER_CLIENT_SCHEMA %>.<%= function_signature['function_name'] %> (<%= function_signature['argument_data_types'] %>) +RETURNS <%= function_signature['result_data_type'] %> AS $$ +DECLARE + ret <%= function_signature['result_data_type'] %>; +BEGIN + -- TODO: this is to be changed according to the feature doc + SELECT <%= GEOCODER_CLIENT_SCHEMA %>._geocode_admin0_polygon(session_user, txid_current(), <%= function_signature['argument_data_types'] %>) INTO ret; + RETURN ret; +END; +$$ LANGUAGE 'plpgsql' SECURITY DEFINER; + +-------------------------------------------------------------------------------- + +CREATE OR REPLACE FUNCTION <%= GEOCODER_CLIENT_SCHEMA %>._<%= function_signature['function_name'] %> (user_id name, tx_id bigint, <%= function_signature['argument_data_types'] %>) +RETURNS Geometry AS $$ + CONNECT <%= GEOCODER_CLIENT_SCHEMA %>._server_conn_str(); + SELECT cdb_geocoder_server.<%= function_signature['function_name'] %> (user_id, tx_id, function_signature['argument_data_types']); +$$ LANGUAGE plproxy; From ec662b58cd7b4b68d4f1056be86b2b382e5ea693 Mon Sep 17 00:00:00 2001 From: Rafa de la Torre Date: Tue, 17 Nov 2015 17:39:15 +0100 Subject: [PATCH 05/13] A generic sql-template-renderer --- interface/generate-grant-execute.rb | 50 ------------------- interface/sql-template-renderer | 35 +++++++++++++ interface/templates/grant-execute.erb | 2 +- .../templates/public-function-definition.erb | 12 ++--- 4 files changed, 42 insertions(+), 57 deletions(-) delete mode 100644 interface/generate-grant-execute.rb create mode 100755 interface/sql-template-renderer diff --git a/interface/generate-grant-execute.rb b/interface/generate-grant-execute.rb deleted file mode 100644 index 2cb001f..0000000 --- a/interface/generate-grant-execute.rb +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env ruby - -# A script to automatically generate SQL files from an interface definition. - -require 'csv' -require 'erb' - -GEOCODER_CLIENT_SCHEMA = 'cdb_geocoder_client' -INTERFACE_SOURCE_FILE = 'interface.csv' - -class GrantExecute - TEMPLATE_FILE = 'templates/grant-execute.erb' - - attr_reader :function_signature - - def initialize(function_signature) - @function_signature = function_signature - @template = File.read(TEMPLATE_FILE) - end - - def render - ERB.new(@template).result(binding) - end -end - -class PublicFunctionDefinition - TEMPLATE_FILE = 'templates/public-function-definition.erb' - - attr_reader :function_signature - - def initialize(function_signature) - @function_signature = function_signature - @template = File.read(TEMPLATE_FILE) - end - - def render - ERB.new(@template).result(binding) - end -end - - -CSV.foreach(INTERFACE_SOURCE_FILE, {headers: true}) do |function_signature| - - function_definition = PublicFunctionDefinition.new(function_signature).render - puts function_definition - - - grant = GrantExecute.new(function_signature).render - #puts grant -end diff --git a/interface/sql-template-renderer b/interface/sql-template-renderer new file mode 100755 index 0000000..950a372 --- /dev/null +++ b/interface/sql-template-renderer @@ -0,0 +1,35 @@ +#!/usr/bin/env ruby + +# A script to automatically generate SQL files from an interface definition. +# To be called like this: sql-template-renderer interface.csv templates/sql-template.erb + +require 'csv' +require 'erb' + +class SqlTemplateRenderer + + GEOCODER_CLIENT_SCHEMA = 'cdb_geocoder_client' + + attr_reader :signature + + def initialize(template_file, signature) + @signature = signature + @template = File.read(template_file) + end + + def render + ERB.new(@template).result(binding) + end +end + +if ARGV.length != 2 then + puts "Usage: sql-template-renderer " + exit +end + +interface_source_file = ARGV[0] +template_file = ARGV[1] + +CSV.foreach(interface_source_file, {headers: true}) do |function_signature| + puts SqlTemplateRenderer.new(template_file, function_signature).render +end diff --git a/interface/templates/grant-execute.erb b/interface/templates/grant-execute.erb index c3aaecb..33503b0 100644 --- a/interface/templates/grant-execute.erb +++ b/interface/templates/grant-execute.erb @@ -1 +1 @@ -GRANT EXECUTE ON FUNCTION <%= GEOCODER_CLIENT_SCHEMA %>.<%= function_signature['function_name'] %>(<%= function_signature['argument_data_types'] %>) TO publicuser; \ No newline at end of file +GRANT EXECUTE ON FUNCTION <%= GEOCODER_CLIENT_SCHEMA %>.<%= signature['function_name'] %>(<%= signature['argument_data_types'] %>) TO publicuser; \ No newline at end of file diff --git a/interface/templates/public-function-definition.erb b/interface/templates/public-function-definition.erb index 8bef626..132beac 100644 --- a/interface/templates/public-function-definition.erb +++ b/interface/templates/public-function-definition.erb @@ -4,21 +4,21 @@ -- These are the only ones with permissions to publicuser role -- and should also be the only ones with SECURITY DEFINER -CREATE OR REPLACE FUNCTION <%= GEOCODER_CLIENT_SCHEMA %>.<%= function_signature['function_name'] %> (<%= function_signature['argument_data_types'] %>) -RETURNS <%= function_signature['result_data_type'] %> AS $$ +CREATE OR REPLACE FUNCTION <%= GEOCODER_CLIENT_SCHEMA %>.<%= signature['function_name'] %> (<%= signature['argument_data_types'] %>) +RETURNS <%= signature['result_data_type'] %> AS $$ DECLARE - ret <%= function_signature['result_data_type'] %>; + ret <%= signature['result_data_type'] %>; BEGIN -- TODO: this is to be changed according to the feature doc - SELECT <%= GEOCODER_CLIENT_SCHEMA %>._geocode_admin0_polygon(session_user, txid_current(), <%= function_signature['argument_data_types'] %>) INTO ret; + SELECT <%= GEOCODER_CLIENT_SCHEMA %>._geocode_admin0_polygon(session_user, txid_current(), <%= signature['argument_data_types'] %>) INTO ret; RETURN ret; END; $$ LANGUAGE 'plpgsql' SECURITY DEFINER; -------------------------------------------------------------------------------- -CREATE OR REPLACE FUNCTION <%= GEOCODER_CLIENT_SCHEMA %>._<%= function_signature['function_name'] %> (user_id name, tx_id bigint, <%= function_signature['argument_data_types'] %>) +CREATE OR REPLACE FUNCTION <%= GEOCODER_CLIENT_SCHEMA %>._<%= signature['function_name'] %> (user_id name, tx_id bigint, <%= signature['argument_data_types'] %>) RETURNS Geometry AS $$ CONNECT <%= GEOCODER_CLIENT_SCHEMA %>._server_conn_str(); - SELECT cdb_geocoder_server.<%= function_signature['function_name'] %> (user_id, tx_id, function_signature['argument_data_types']); + SELECT cdb_geocoder_server.<%= signature['function_name'] %> (user_id, tx_id, signature['argument_data_types']); $$ LANGUAGE plproxy; From 68dba7136b275de0b68a1ced8eaef422bf06a417 Mon Sep 17 00:00:00 2001 From: Rafa de la Torre Date: Wed, 18 Nov 2015 15:14:08 +0100 Subject: [PATCH 06/13] Split and rename the templates --- .../{grant-execute.erb => client-grant-execute.erb} | 0 interface/templates/client-plproxy-function.erb | 5 +++++ ...-function-definition.erb => client-public-function.erb} | 7 ------- 3 files changed, 5 insertions(+), 7 deletions(-) rename interface/templates/{grant-execute.erb => client-grant-execute.erb} (100%) create mode 100644 interface/templates/client-plproxy-function.erb rename interface/templates/{public-function-definition.erb => client-public-function.erb} (59%) diff --git a/interface/templates/grant-execute.erb b/interface/templates/client-grant-execute.erb similarity index 100% rename from interface/templates/grant-execute.erb rename to interface/templates/client-grant-execute.erb diff --git a/interface/templates/client-plproxy-function.erb b/interface/templates/client-plproxy-function.erb new file mode 100644 index 0000000..f877f25 --- /dev/null +++ b/interface/templates/client-plproxy-function.erb @@ -0,0 +1,5 @@ +CREATE OR REPLACE FUNCTION <%= GEOCODER_CLIENT_SCHEMA %>._<%= signature['function_name'] %> (user_id name, tx_id bigint, <%= signature['argument_data_types'] %>) +RETURNS Geometry AS $$ + CONNECT <%= GEOCODER_CLIENT_SCHEMA %>._server_conn_str(); + SELECT cdb_geocoder_server.<%= signature['function_name'] %> (user_id, tx_id, signature['argument_data_types']); +$$ LANGUAGE plproxy; diff --git a/interface/templates/public-function-definition.erb b/interface/templates/client-public-function.erb similarity index 59% rename from interface/templates/public-function-definition.erb rename to interface/templates/client-public-function.erb index 132beac..3d994b0 100644 --- a/interface/templates/public-function-definition.erb +++ b/interface/templates/client-public-function.erb @@ -15,10 +15,3 @@ BEGIN END; $$ LANGUAGE 'plpgsql' SECURITY DEFINER; --------------------------------------------------------------------------------- - -CREATE OR REPLACE FUNCTION <%= GEOCODER_CLIENT_SCHEMA %>._<%= signature['function_name'] %> (user_id name, tx_id bigint, <%= signature['argument_data_types'] %>) -RETURNS Geometry AS $$ - CONNECT <%= GEOCODER_CLIENT_SCHEMA %>._server_conn_str(); - SELECT cdb_geocoder_server.<%= signature['function_name'] %> (user_id, tx_id, signature['argument_data_types']); -$$ LANGUAGE plproxy; From c82359f7d74e0b8db63f147d9b4adf82f7e8dc66 Mon Sep 17 00:00:00 2001 From: Rafa de la Torre Date: Wed, 18 Nov 2015 16:17:36 +0100 Subject: [PATCH 07/13] Generate files in Makefile (WIP) --- client/Makefile | 19 +++++- client/sql/0.0.1/10_admin0.sql | 26 -------- ...r_conn.sql => 10_geocoder_server_conn.sql} | 0 client/sql/0.0.1/20_admin1.sql | 45 -------------- client/sql/0.0.1/30_namedplaces.sql | 62 ------------------- client/sql/0.0.1/40_postalcodes.sql | 45 -------------- client/sql/0.0.1/50_ipaddresses.sql | 27 -------- client/sql/0.0.1/80_permissions.sql | 9 +++ client/sql/0.0.1/90_permissions.sql | 23 ------- .../templates/20_public_functions.erb | 0 .../templates/30_plproxy_functions.erb | 0 .../templates/90_grant_execute.erb | 0 interface/interface.csv => interface.csv | 0 ...template-renderer => sql-template-renderer | 0 14 files changed, 26 insertions(+), 230 deletions(-) delete mode 100644 client/sql/0.0.1/10_admin0.sql rename client/sql/0.0.1/{06_geocoder_server_conn.sql => 10_geocoder_server_conn.sql} (100%) delete mode 100644 client/sql/0.0.1/20_admin1.sql delete mode 100644 client/sql/0.0.1/30_namedplaces.sql delete mode 100644 client/sql/0.0.1/40_postalcodes.sql delete mode 100644 client/sql/0.0.1/50_ipaddresses.sql create mode 100644 client/sql/0.0.1/80_permissions.sql delete mode 100644 client/sql/0.0.1/90_permissions.sql rename interface/templates/client-public-function.erb => client/templates/20_public_functions.erb (100%) rename interface/templates/client-plproxy-function.erb => client/templates/30_plproxy_functions.erb (100%) rename interface/templates/client-grant-execute.erb => client/templates/90_grant_execute.erb (100%) rename interface/interface.csv => interface.csv (100%) rename interface/sql-template-renderer => sql-template-renderer (100%) diff --git a/client/Makefile b/client/Makefile index 652539f..02066e2 100644 --- a/client/Makefile +++ b/client/Makefile @@ -12,14 +12,29 @@ PG_CONFIG = pg_config PGXS := $(shell $(PG_CONFIG) --pgxs) include $(PGXS) +SOURCES_DATA_DIR = sql/$(EXTVERSION) -SOURCES_DATA = $(wildcard sql/$(EXTVERSION)/*.sql) +# The interface definition is used along with some templates to automatically generate code +RENDERER = ../sql-template-renderer +INTERFACE_FILE = ../interface.csv +TEMPLATE_DIR = templates +TEMPLATE_FILES = $(wildcard $(TEMPLATE_DIR)/*.erb) +GENERATED_SQL_FILES = $(patsubst $(TEMPLATE_DIR)/%.erb, $(SOURCES_DATA_DIR)/%.sql, $(TEMPLATE_FILES)) + +$(GENERATED_SQL_FILES): $(SOURCES_DATA_DIR)/%.sql: $(TEMPLATE_DIR)/%.erb $(INTERFACE_FILE) $(RENDERER) + $(RENDERER) $(INTERFACE_FILE) $< > $@ + +all: $(GENERATED_SQL_FILES) + @echo $(GENERATED_SQL_FILES) + + +SOURCES_DATA = $(wildcard $(SOURCES_DATA_DIR)/*.sql) $(DATA): $(SOURCES_DATA) rm -f $@ cat $(SOURCES_DATA) >> $@ -all: $(DATA) +#all: $(DATA) # Only meant for development time, do not use once a version is released devclean: diff --git a/client/sql/0.0.1/10_admin0.sql b/client/sql/0.0.1/10_admin0.sql deleted file mode 100644 index 6337496..0000000 --- a/client/sql/0.0.1/10_admin0.sql +++ /dev/null @@ -1,26 +0,0 @@ --- --- Public geocoder API function --- --- These are the only ones with permissions to publicuser role --- and should also be the only ones with SECURITY DEFINER - -CREATE OR REPLACE FUNCTION cdb_geocoder_client.geocode_admin0_polygon(country_name text) -RETURNS Geometry AS $$ -DECLARE - ret Geometry; -BEGIN - SELECT cdb_geocoder_client._geocode_admin0_polygon(session_user, txid_current(), country_name) INTO ret; - RETURN ret; -END; -$$ LANGUAGE 'plpgsql' SECURITY DEFINER; - - --- TODO: review all permissions stuff [I'd explicitly grant permissions to the public functions] - --------------------------------------------------------------------------------- - -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_polygon(user_id, tx_id, country_name); -$$ LANGUAGE plproxy; diff --git a/client/sql/0.0.1/06_geocoder_server_conn.sql b/client/sql/0.0.1/10_geocoder_server_conn.sql similarity index 100% rename from client/sql/0.0.1/06_geocoder_server_conn.sql rename to client/sql/0.0.1/10_geocoder_server_conn.sql diff --git a/client/sql/0.0.1/20_admin1.sql b/client/sql/0.0.1/20_admin1.sql deleted file mode 100644 index f7d0088..0000000 --- a/client/sql/0.0.1/20_admin1.sql +++ /dev/null @@ -1,45 +0,0 @@ --- --- Public geocoder API function --- --- These are the only ones with permissions to publicuser role --- and should also be the only ones with SECURITY DEFINER - ----- geocode_admin1_polygon(admin1_name text) -CREATE OR REPLACE FUNCTION cdb_geocoder_client.geocode_admin1_polygon(admin1_name text) -RETURNS Geometry AS $$ -DECLARE - ret Geometry; -BEGIN - SELECT cdb_geocoder_client._geocode_admin1_polygon(session_user, txid_current(), admin1_name) INTO ret; - RETURN ret; -END; -$$ LANGUAGE 'plpgsql' SECURITY DEFINER; - ----- geocode_admin1_polygon(admin1_name text, country_name text) -CREATE OR REPLACE FUNCTION cdb_geocoder_client.geocode_admin1_polygon(admin1_name text, country_name text) -RETURNS Geometry AS $$ -DECLARE - ret Geometry; -BEGIN - SELECT cdb_geocoder_client._geocode_admin1_polygon(session_user, txid_current(), admin1_name, country_name) INTO ret; - RETURN ret; -END; -$$ LANGUAGE 'plpgsql' SECURITY DEFINER; - --- TODO: review all permissions stuff [I'd explicitly grant permissions to the public functions] - --------------------------------------------------------------------------------- - ----- geocode_admin1_polygon(admin1_name text) -CREATE OR REPLACE FUNCTION cdb_geocoder_client._geocode_admin1_polygon(user_id name, tx_id bigint, admin1_name text) -RETURNS Geometry AS $$ - CONNECT cdb_geocoder_client._server_conn_str(); - SELECT cdb_geocoder_server.geocode_admin1_polygon(user_id, tx_id, admin1_name); -$$ LANGUAGE plproxy; - ----- geocode_admin1_polygon(admin1_name text, country_name text) -CREATE OR REPLACE FUNCTION cdb_geocoder_client._geocode_admin1_polygon(user_id name, tx_id bigint, admin1_name text, country_name text) -RETURNS Geometry AS $$ - CONNECT cdb_geocoder_client._server_conn_str(); - SELECT cdb_geocoder_server.geocode_admin1_polygon(user_id, tx_id, admin1_name, country_name); -$$ LANGUAGE plproxy; diff --git a/client/sql/0.0.1/30_namedplaces.sql b/client/sql/0.0.1/30_namedplaces.sql deleted file mode 100644 index 8ac6a9d..0000000 --- a/client/sql/0.0.1/30_namedplaces.sql +++ /dev/null @@ -1,62 +0,0 @@ --- --- Public geocoder API function --- --- These are the only ones with permissions to publicuser role --- and should also be the only ones with SECURITY DEFINER - ----- geocode_namedplace_point(city_name text) -CREATE OR REPLACE FUNCTION cdb_geocoder_client.geocode_namedplace_point(city_name text) -RETURNS Geometry AS $$ -DECLARE - ret Geometry; -BEGIN - SELECT cdb_geocoder_client._geocode_namedplace_point(session_user, txid_current(), city_name) INTO ret; - RETURN ret; -END; -$$ LANGUAGE 'plpgsql' SECURITY DEFINER; - ----- geocode_namedplace_point(city_name text, country_name text) -CREATE OR REPLACE FUNCTION cdb_geocoder_client.geocode_namedplace_point(city_name text, country_name text) -RETURNS Geometry AS $$ -DECLARE - ret Geometry; -BEGIN - SELECT cdb_geocoder_client._geocode_namedplace_point(session_user, txid_current(), city_name, country_name) INTO ret; - RETURN ret; -END; -$$ LANGUAGE 'plpgsql' SECURITY DEFINER; - ----- geocode_namedplace_point(city_name text, admin1_name text, country_name text) -CREATE OR REPLACE FUNCTION cdb_geocoder_client.geocode_namedplace_point(city_name text, admin1_name text, country_name text) -RETURNS Geometry AS $$ -DECLARE - ret Geometry; -BEGIN - SELECT cdb_geocoder_client._geocode_namedplace_point(session_user, txid_current(), city_name, admin1_name, country_name) INTO ret; - RETURN ret; -END; -$$ LANGUAGE 'plpgsql' SECURITY DEFINER; --- TODO: review all permissions stuff [I'd explicitly grant permissions to the public functions] - --------------------------------------------------------------------------------- - ----- geocode_namedplace_point(city_name text) -CREATE OR REPLACE FUNCTION cdb_geocoder_client._geocode_namedplace_point(user_id name, tx_id bigint, city_name text) -RETURNS Geometry AS $$ - CONNECT cdb_geocoder_client._server_conn_str(); - SELECT cdb_geocoder_server.geocode_namedplace_point(user_id, tx_id, city_name); -$$ LANGUAGE plproxy; - ----- geocode_namedplace_point(city_name text, country_name text) -CREATE OR REPLACE FUNCTION cdb_geocoder_client._geocode_namedplace_point(user_id name, tx_id bigint, city_name text, country_name text) -RETURNS Geometry AS $$ - CONNECT cdb_geocoder_client._server_conn_str(); - SELECT cdb_geocoder_server.geocode_namedplace_point(user_id, tx_id, city_name, country_name); -$$ LANGUAGE plproxy; - ----- geocode_namedplace_point(city_name text, admin1_name text, country_name text) -CREATE OR REPLACE FUNCTION cdb_geocoder_client._geocode_namedplace_point(user_id name, tx_id bigint, city_name text, admin1_name text, country_name text) -RETURNS Geometry AS $$ - CONNECT cdb_geocoder_client._server_conn_str(); - SELECT cdb_geocoder_server.geocode_namedplace_point(user_id, tx_id, city_name, admin1_name, country_name); -$$ LANGUAGE plproxy; \ No newline at end of file diff --git a/client/sql/0.0.1/40_postalcodes.sql b/client/sql/0.0.1/40_postalcodes.sql deleted file mode 100644 index f3afcc8..0000000 --- a/client/sql/0.0.1/40_postalcodes.sql +++ /dev/null @@ -1,45 +0,0 @@ --- --- Public geocoder API function --- --- These are the only ones with permissions to publicuser role --- and should also be the only ones with SECURITY DEFINER - ----- geocode_postalcode_polygon(postal_code text, country_name text) -CREATE OR REPLACE FUNCTION cdb_geocoder_client.geocode_postalcode_polygon(postal_code text, country_name text) -RETURNS Geometry AS $$ -DECLARE - ret Geometry; -BEGIN - SELECT cdb_geocoder_client._geocode_postalcode_polygon(session_user, txid_current(), postal_code, country_name) INTO ret; - RETURN ret; -END; -$$ LANGUAGE 'plpgsql' SECURITY DEFINER; - ----- geocode_postalcode_polygon(postal_code integer, country_name text) -CREATE OR REPLACE FUNCTION cdb_geocoder_client.geocode_postalcode_point(postal_code text, country_name text) -RETURNS Geometry AS $$ -DECLARE - ret Geometry; -BEGIN - SELECT cdb_geocoder_client._geocode_postalcode_point(session_user, txid_current(), postal_code, country_name) INTO ret; - RETURN ret; -END; -$$ LANGUAGE 'plpgsql' SECURITY DEFINER; - --- TODO: review all permissions stuff [I'd explicitly grant permissions to the public functions] - --------------------------------------------------------------------------------- - ----- geocode_postalcode_polygon(postal_code text, country_name text) -CREATE OR REPLACE FUNCTION cdb_geocoder_client._geocode_postalcode_polygon(user_id name, tx_id bigint, postal_code text, country_name text) -RETURNS Geometry AS $$ - CONNECT cdb_geocoder_client._server_conn_str(); - SELECT cdb_geocoder_server.geocode_postalcode_polygon(user_id, tx_id, postal_code, country_name); -$$ LANGUAGE plproxy; - ----- geocode_postalcode_polygon(postal_code text, country_name text) -CREATE OR REPLACE FUNCTION cdb_geocoder_client._geocode_postalcode_point(user_id name, tx_id bigint, postal_code text, country_name text) -RETURNS Geometry AS $$ - CONNECT cdb_geocoder_client._server_conn_str(); - SELECT cdb_geocoder_server.geocode_postalcode_polygon(user_id, tx_id, postal_code, country_name); -$$ LANGUAGE plproxy; diff --git a/client/sql/0.0.1/50_ipaddresses.sql b/client/sql/0.0.1/50_ipaddresses.sql deleted file mode 100644 index 60602ab..0000000 --- a/client/sql/0.0.1/50_ipaddresses.sql +++ /dev/null @@ -1,27 +0,0 @@ --- --- Public geocoder API function --- --- These are the only ones with permissions to publicuser role --- and should also be the only ones with SECURITY DEFINER - ----- geocode_ipaddress_point(city_name text) -CREATE OR REPLACE FUNCTION cdb_geocoder_client.geocode_ipaddress_point(ip_address text) -RETURNS Geometry AS $$ -DECLARE - ret Geometry; -BEGIN - SELECT cdb_geocoder_client._geocode_ipaddress_point(session_user, txid_current(), ip_address) INTO ret; - RETURN ret; -END; -$$ LANGUAGE 'plpgsql' SECURITY DEFINER; - --- TODO: review all permissions stuff [I'd explicitly grant permissions to the public functions] - --------------------------------------------------------------------------------- - ----- geocode_ipaddress_point(ip_address text) -CREATE OR REPLACE FUNCTION cdb_geocoder_client._geocode_ipaddress_point(user_id name, tx_id bigint, ip_address text) -RETURNS Geometry AS $$ - CONNECT cdb_geocoder_client._server_conn_str(); - SELECT cdb_geocoder_server.geocode_ipaddress_point(user_id, tx_id, ip_address); -$$ LANGUAGE plproxy; diff --git a/client/sql/0.0.1/80_permissions.sql b/client/sql/0.0.1/80_permissions.sql new file mode 100644 index 0000000..16fc021 --- /dev/null +++ b/client/sql/0.0.1/80_permissions.sql @@ -0,0 +1,9 @@ +-- Make sure by default there are no permissions for publicuser +-- NOTE: this happens at extension creation time, as part of an implicit transaction. +REVOKE ALL PRIVILEGES ON SCHEMA cdb_geocoder_client FROM PUBLIC, publicuser CASCADE; + +-- Grant permissions on the schema to publicuser (but just the schema) +GRANT USAGE ON SCHEMA cdb_geocoder_client TO publicuser; + +-- Revoke execute permissions on all functions in the schema by default +REVOKE EXECUTE ON ALL FUNCTIONS IN SCHEMA cdb_geocoder_client FROM PUBLIC, publicuser; diff --git a/client/sql/0.0.1/90_permissions.sql b/client/sql/0.0.1/90_permissions.sql deleted file mode 100644 index 9fea793..0000000 --- a/client/sql/0.0.1/90_permissions.sql +++ /dev/null @@ -1,23 +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_geocoder_client FROM PUBLIC, publicuser CASCADE; - --- Grant permissions on the schema to publicuser (but just the schema) -GRANT USAGE ON SCHEMA cdb_geocoder_client TO publicuser; - --- Revoke execute permissions on all functions in the schema by default -REVOKE EXECUTE ON ALL FUNCTIONS IN SCHEMA cdb_geocoder_client FROM PUBLIC, publicuser; - --------------------------------------------------------------------------------- - --- 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_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; -GRANT EXECUTE ON FUNCTION cdb_geocoder_client.geocode_namedplace_point(city_name text, country_name text) TO publicuser; -GRANT EXECUTE ON FUNCTION cdb_geocoder_client.geocode_namedplace_point(city_name text, admin1_name text, country_name text) TO publicuser; -GRANT EXECUTE ON FUNCTION cdb_geocoder_client.geocode_postalcode_polygon(postal_code text, country_name text) TO publicuser; -GRANT EXECUTE ON FUNCTION cdb_geocoder_client.geocode_postalcode_point(postal_code text, country_name text) TO publicuser; -GRANT EXECUTE ON FUNCTION cdb_geocoder_client.geocode_ipaddress_point(ip_address text) TO publicuser; diff --git a/interface/templates/client-public-function.erb b/client/templates/20_public_functions.erb similarity index 100% rename from interface/templates/client-public-function.erb rename to client/templates/20_public_functions.erb diff --git a/interface/templates/client-plproxy-function.erb b/client/templates/30_plproxy_functions.erb similarity index 100% rename from interface/templates/client-plproxy-function.erb rename to client/templates/30_plproxy_functions.erb diff --git a/interface/templates/client-grant-execute.erb b/client/templates/90_grant_execute.erb similarity index 100% rename from interface/templates/client-grant-execute.erb rename to client/templates/90_grant_execute.erb diff --git a/interface/interface.csv b/interface.csv similarity index 100% rename from interface/interface.csv rename to interface.csv diff --git a/interface/sql-template-renderer b/sql-template-renderer similarity index 100% rename from interface/sql-template-renderer rename to sql-template-renderer From 0d85afc99a28ba6dde951bbe1754509d44b27f97 Mon Sep 17 00:00:00 2001 From: Rafa de la Torre Date: Wed, 18 Nov 2015 18:38:06 +0100 Subject: [PATCH 08/13] Adapt to yaml (WIP) --- client/Makefile | 13 +++----- client/templates/20_public_functions.erb | 9 +++--- client/templates/30_plproxy_functions.erb | 4 +-- client/templates/90_grant_execute.erb | 2 +- interface.yaml | 16 ++++++++++ sql-template-renderer | 37 +++++++++++++++++------ 6 files changed, 56 insertions(+), 25 deletions(-) create mode 100644 interface.yaml diff --git a/client/Makefile b/client/Makefile index 02066e2..1e0696c 100644 --- a/client/Makefile +++ b/client/Makefile @@ -16,7 +16,7 @@ SOURCES_DATA_DIR = sql/$(EXTVERSION) # The interface definition is used along with some templates to automatically generate code RENDERER = ../sql-template-renderer -INTERFACE_FILE = ../interface.csv +INTERFACE_FILE = ../interface.yaml TEMPLATE_DIR = templates TEMPLATE_FILES = $(wildcard $(TEMPLATE_DIR)/*.erb) GENERATED_SQL_FILES = $(patsubst $(TEMPLATE_DIR)/%.erb, $(SOURCES_DATA_DIR)/%.sql, $(TEMPLATE_FILES)) @@ -24,18 +24,15 @@ GENERATED_SQL_FILES = $(patsubst $(TEMPLATE_DIR)/%.erb, $(SOURCES_DATA_DIR)/%.sq $(GENERATED_SQL_FILES): $(SOURCES_DATA_DIR)/%.sql: $(TEMPLATE_DIR)/%.erb $(INTERFACE_FILE) $(RENDERER) $(RENDERER) $(INTERFACE_FILE) $< > $@ -all: $(GENERATED_SQL_FILES) - @echo $(GENERATED_SQL_FILES) - - -SOURCES_DATA = $(wildcard $(SOURCES_DATA_DIR)/*.sql) +SOURCES_DATA = $(wildcard $(SOURCES_DATA_DIR)/*.sql) $(GENERATED_SQL_FILES) $(DATA): $(SOURCES_DATA) rm -f $@ - cat $(SOURCES_DATA) >> $@ + cat $(SOURCES_DATA_DIR)/*.sql >> $@ -#all: $(DATA) +all: $(DATA) # Only meant for development time, do not use once a version is released devclean: rm -f $(DATA) + rm -f $(GENERATED_SQL_FILES) diff --git a/client/templates/20_public_functions.erb b/client/templates/20_public_functions.erb index 3d994b0..127f54e 100644 --- a/client/templates/20_public_functions.erb +++ b/client/templates/20_public_functions.erb @@ -4,13 +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 <%= GEOCODER_CLIENT_SCHEMA %>.<%= signature['function_name'] %> (<%= signature['argument_data_types'] %>) -RETURNS <%= signature['result_data_type'] %> AS $$ +CREATE OR REPLACE FUNCTION <%= GEOCODER_CLIENT_SCHEMA %>.<%= name %> (<%= params_with_type %>) +RETURNS <%= return_type %> AS $$ DECLARE - ret <%= signature['result_data_type'] %>; + ret <%= return_type %>; BEGIN - -- TODO: this is to be changed according to the feature doc - SELECT <%= GEOCODER_CLIENT_SCHEMA %>._geocode_admin0_polygon(session_user, txid_current(), <%= signature['argument_data_types'] %>) INTO ret; + SELECT <%= GEOCODER_CLIENT_SCHEMA %>._geocode_admin0_polygon(session_user, txid_current(), <%= params %>) INTO ret; RETURN ret; END; $$ LANGUAGE 'plpgsql' SECURITY DEFINER; diff --git a/client/templates/30_plproxy_functions.erb b/client/templates/30_plproxy_functions.erb index f877f25..22d6ffc 100644 --- a/client/templates/30_plproxy_functions.erb +++ b/client/templates/30_plproxy_functions.erb @@ -1,5 +1,5 @@ -CREATE OR REPLACE FUNCTION <%= GEOCODER_CLIENT_SCHEMA %>._<%= signature['function_name'] %> (user_id name, tx_id bigint, <%= signature['argument_data_types'] %>) +CREATE OR REPLACE FUNCTION <%= GEOCODER_CLIENT_SCHEMA %>._<%= name %> (user_id name, tx_id bigint, <%= params_with_type %>) RETURNS Geometry AS $$ CONNECT <%= GEOCODER_CLIENT_SCHEMA %>._server_conn_str(); - SELECT cdb_geocoder_server.<%= signature['function_name'] %> (user_id, tx_id, signature['argument_data_types']); + SELECT cdb_geocoder_server.<%= name %> (user_id, tx_id, <%= params %>); $$ LANGUAGE plproxy; diff --git a/client/templates/90_grant_execute.erb b/client/templates/90_grant_execute.erb index 33503b0..97415ca 100644 --- a/client/templates/90_grant_execute.erb +++ b/client/templates/90_grant_execute.erb @@ -1 +1 @@ -GRANT EXECUTE ON FUNCTION <%= GEOCODER_CLIENT_SCHEMA %>.<%= signature['function_name'] %>(<%= signature['argument_data_types'] %>) TO publicuser; \ No newline at end of file +GRANT EXECUTE ON FUNCTION <%= GEOCODER_CLIENT_SCHEMA %>.<%= name %>(<%= params_with_type %>) TO publicuser; \ No newline at end of file diff --git a/interface.yaml b/interface.yaml new file mode 100644 index 0000000..1fbdc9d --- /dev/null +++ b/interface.yaml @@ -0,0 +1,16 @@ +--- +- name: geocode_admin0_polygon + return_type: Geometry + params: + - { name: country_name, type: text } + +- name: geocode_admin1_polygon + return_type: Geometry + params: + - { name: admin1_name, type: text } + +- name: geocode_admin1_polygon + return_type: Geometry + params: + - { name: admin1_name, type: text } + - { name: country_name, type: text } \ No newline at end of file diff --git a/sql-template-renderer b/sql-template-renderer index 950a372..526bd89 100755 --- a/sql-template-renderer +++ b/sql-template-renderer @@ -3,33 +3,52 @@ # A script to automatically generate SQL files from an interface definition. # To be called like this: sql-template-renderer interface.csv templates/sql-template.erb -require 'csv' +require 'yaml' require 'erb' class SqlTemplateRenderer GEOCODER_CLIENT_SCHEMA = 'cdb_geocoder_client' - attr_reader :signature - - def initialize(template_file, signature) - @signature = signature + def initialize(template_file, function_signature) + @f = function_signature @template = File.read(template_file) end def render ERB.new(@template).result(binding) - end + end + + def name + @f['name'] + end + + def return_type + @f['return_type'] + end + + def params + @f['params'].map { |p| p['name'] }.join(', ') + end + + def params_with_type + @f['params'].map { |p| "#{p['name']} #{p['type']}"}.join(', ') + end + end + if ARGV.length != 2 then - puts "Usage: sql-template-renderer " + puts "Usage: sql-template-renderer " exit end interface_source_file = ARGV[0] template_file = ARGV[1] -CSV.foreach(interface_source_file, {headers: true}) do |function_signature| - puts SqlTemplateRenderer.new(template_file, function_signature).render + +functions = YAML.load(File.open(interface_source_file)) + +functions.each do |f| + puts SqlTemplateRenderer.new(template_file, f).render end From 716b8dc43e665fc9f46823695a6e5a1a8d910bac Mon Sep 17 00:00:00 2001 From: Rafa de la Torre Date: Wed, 18 Nov 2015 18:00:08 +0000 Subject: [PATCH 09/13] Fix typo in template --- client/templates/20_public_functions.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/templates/20_public_functions.erb b/client/templates/20_public_functions.erb index 127f54e..483a3a8 100644 --- a/client/templates/20_public_functions.erb +++ b/client/templates/20_public_functions.erb @@ -9,7 +9,7 @@ RETURNS <%= return_type %> AS $$ DECLARE ret <%= return_type %>; BEGIN - SELECT <%= GEOCODER_CLIENT_SCHEMA %>._geocode_admin0_polygon(session_user, txid_current(), <%= params %>) INTO ret; + SELECT <%= GEOCODER_CLIENT_SCHEMA %>._<%= name %>(session_user, txid_current(), <%= params %>) INTO ret; RETURN ret; END; $$ LANGUAGE 'plpgsql' SECURITY DEFINER; From 81356ca92c4223cca5518e965d35de97d6e0720b Mon Sep 17 00:00:00 2001 From: Rafa de la Torre Date: Wed, 18 Nov 2015 19:04:54 +0100 Subject: [PATCH 10/13] Adapt interface to yaml (WIP) --- interface.csv | 10 ---------- interface.yaml | 31 ++++++++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 11 deletions(-) delete mode 100644 interface.csv diff --git a/interface.csv b/interface.csv deleted file mode 100644 index f8171e1..0000000 --- a/interface.csv +++ /dev/null @@ -1,10 +0,0 @@ -function_name,result_data_type,argument_data_types -geocode_admin0_polygon,Geometry,"country_name text" -geocode_admin1_polygon,Geometry,"admin1_name text" -geocode_admin1_polygon,Geometry,"admin1_name text, country_name text" -geocode_namedplace_point,Geometry,"city_name text" -geocode_namedplace_point,Geometry,"city_name text, country_name text" -geocode_namedplace_point,Geometry,"city_name text, admin1_name text, country_name text" -geocode_postalcode_polygon,Geometry,"postal_code text, country_name text" -geocode_postalcode_point,Geometry,"postal_code text, country_name text" -geocode_ipaddress_point,Geometry,"ip_address text" diff --git a/interface.yaml b/interface.yaml index 1fbdc9d..6270999 100644 --- a/interface.yaml +++ b/interface.yaml @@ -13,4 +13,33 @@ return_type: Geometry params: - { name: admin1_name, type: text } - - { name: country_name, type: text } \ No newline at end of file + - { name: country_name, type: text } + +- name: geocode_namedplace_point + return_type: Geometry + params: + - { name: city_name, type: text} + +- name: geocode_namedplace_point + return_type: Geometry + params: + - { name: city_name, type: text} + - { name: country_name, type: text} + +- name: geocode_postalcode_polygon + return_type: Geometry + params: + - { name: postal_code, type: text} + - { name: country_name, type: text} + +- name: geocode_postalcode_point + return_type: Geometry + params: + - { name: postal_code, type: text} + - { name: country_name, type: text} + +- name: geocode_ipaddress_point + return_type: Geometry + params: + - { name: ip_address, type: text} + From a7877c6eba9948a3a95fe994125b5db45644270c Mon Sep 17 00:00:00 2001 From: Rafa de la Torre Date: Wed, 18 Nov 2015 18:06:45 +0000 Subject: [PATCH 11/13] Add missing function to interface definition (WIP) --- interface.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/interface.yaml b/interface.yaml index 6270999..7e525a0 100644 --- a/interface.yaml +++ b/interface.yaml @@ -26,6 +26,14 @@ - { name: city_name, type: text} - { name: country_name, type: text} +- name: geocode_namedplace_point + return_type: Geometry + params: + - { name: city_name, type: text} + - { name: admin1_name, type: text} + - { name: country_name, type: text} + + - name: geocode_postalcode_polygon return_type: Geometry params: From 247e73b1b5c1917ba2e6d7483f3ce8cf9e8b0696 Mon Sep 17 00:00:00 2001 From: Rafa de la Torre Date: Wed, 18 Nov 2015 19:09:39 +0100 Subject: [PATCH 12/13] Fix typo in two tests --- client/expected/40_postalcodes_test.out | 2 +- client/expected/90_permissions_test.out | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/expected/40_postalcodes_test.out b/client/expected/40_postalcodes_test.out index 7b3b824..a4477ec 100644 --- a/client/expected/40_postalcodes_test.out +++ b/client/expected/40_postalcodes_test.out @@ -24,7 +24,7 @@ PL/pgSQL function cdb_geocoder_client.geocode_postalcode_polygon(text,text) line (1 row) SELECT cdb_geocoder_client.geocode_postalcode_point('03204', 'Spain'); -NOTICE: cdb_geocoder_client._geocode_postalcode_point(4): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.geocode_postalcode_polygon invoked with params (postgres, some_transaction_id, 03204, Spain) +NOTICE: cdb_geocoder_client._geocode_postalcode_point(4): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.geocode_postalcode_point invoked with params (postgres, some_transaction_id, 03204, Spain) CONTEXT: SQL statement "SELECT cdb_geocoder_client._geocode_postalcode_point(session_user, txid_current(), postal_code, country_name)" PL/pgSQL function cdb_geocoder_client.geocode_postalcode_point(text,text) line 5 at SQL statement geocode_postalcode_point diff --git a/client/expected/90_permissions_test.out b/client/expected/90_permissions_test.out index 00124ec..14e78f8 100644 --- a/client/expected/90_permissions_test.out +++ b/client/expected/90_permissions_test.out @@ -66,7 +66,7 @@ PL/pgSQL function cdb_geocoder_client.geocode_postalcode_polygon(text,text) line (1 row) SELECT cdb_geocoder_client.geocode_postalcode_point('03204', 'Spain'); -NOTICE: cdb_geocoder_client._geocode_postalcode_point(4): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.geocode_postalcode_polygon invoked with params (postgres, some_transaction_id, 03204, Spain) +NOTICE: cdb_geocoder_client._geocode_postalcode_point(4): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.geocode_postalcode_point invoked with params (postgres, some_transaction_id, 03204, Spain) CONTEXT: SQL statement "SELECT cdb_geocoder_client._geocode_postalcode_point(session_user, txid_current(), postal_code, country_name)" PL/pgSQL function cdb_geocoder_client.geocode_postalcode_point(text,text) line 5 at SQL statement geocode_postalcode_point From a6f3b74fd5780d414c677d79ea3047c5768cbf4f Mon Sep 17 00:00:00 2001 From: Rafa de la Torre Date: Wed, 18 Nov 2015 19:24:01 +0100 Subject: [PATCH 13/13] Add generated files to .gitignore --- client/sql/0.0.1/.gitignore | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 client/sql/0.0.1/.gitignore diff --git a/client/sql/0.0.1/.gitignore b/client/sql/0.0.1/.gitignore new file mode 100644 index 0000000..4cf1e95 --- /dev/null +++ b/client/sql/0.0.1/.gitignore @@ -0,0 +1,3 @@ +20_public_functions.sql +30_plproxy_functions.sql +90_grant_execute.sql