From 074234b8dab8cbb7079fc9f8832280d90a1678b4 Mon Sep 17 00:00:00 2001 From: Rafa de la Torre Date: Fri, 7 Jul 2017 13:08:41 +0200 Subject: [PATCH] Use double precision as numeric type As shown in the tests, that type has the flexibility of being able to be cast to from any other numeric type. This gives us flexibility without bloating the API with lots of type-specific functions. --- client/renderer/interface.yaml | 4 ++-- server/extension/sql/60_postalcodes.sql | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/client/renderer/interface.yaml b/client/renderer/interface.yaml index 2fd9274..b94d80f 100644 --- a/client/renderer/interface.yaml +++ b/client/renderer/interface.yaml @@ -42,7 +42,7 @@ - name: cdb_geocode_postalcode_polygon return_type: Geometry params: - - { name: postal_code, type: integer} + - { name: postal_code, type: double precision} - { name: country_name, type: text} - name: cdb_geocode_postalcode_point @@ -54,7 +54,7 @@ - name: cdb_geocode_postalcode_point return_type: Geometry params: - - { name: postal_code, type: integer} + - { name: postal_code, type: double precision} - { name: country_name, type: text} - name: cdb_geocode_ipaddress_point diff --git a/server/extension/sql/60_postalcodes.sql b/server/extension/sql/60_postalcodes.sql index e7e8101..3639d5d 100644 --- a/server/extension/sql/60_postalcodes.sql +++ b/server/extension/sql/60_postalcodes.sql @@ -1,4 +1,4 @@ -CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_point(username text, orgname text, code integer) +CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_point(username text, orgname text, code double precision) RETURNS Geometry AS $$ SELECT cdb_dataservices_server.cdb_geocode_postalcode_point(username, orgname, code::text); $$ LANGUAGE SQL; @@ -40,7 +40,7 @@ RETURNS Geometry AS $$ $$ LANGUAGE plpythonu; -CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_point(username text, orgname text, code integer, country text) +CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_point(username text, orgname text, code double precision, country text) RETURNS Geometry AS $$ SELECT cdb_dataservices_server.cdb_geocode_postalcode_point(username, orgname, code::text, country) $$ LANGUAGE SQL; @@ -82,7 +82,7 @@ RETURNS Geometry AS $$ $$ LANGUAGE plpythonu; -CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_polygon(username text, orgname text, code integer) +CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_polygon(username text, orgname text, code double precision) RETURNS Geometry AS $$ SELECT cdb_dataservices_server.cdb_geocode_postalcode_polygon(username, orgname, code::text) $$ LANGUAGE SQL; @@ -124,7 +124,7 @@ RETURNS Geometry AS $$ $$ LANGUAGE plpythonu; -CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_polygon(username text, orgname text, code integer, country text) +CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_postalcode_polygon(username text, orgname text, code double precision, country text) RETURNS Geometry AS $$ SELECT cdb_dataservices_server.cdb_geocode_postalcode_polygon(username, orgname, code::text, country) $$ LANGUAGE SQL;