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.
This commit is contained in:
Rafa de la Torre 2017-07-07 13:08:41 +02:00
parent e123079e92
commit 074234b8da
2 changed files with 6 additions and 6 deletions

View File

@ -42,7 +42,7 @@
- name: cdb_geocode_postalcode_polygon - name: cdb_geocode_postalcode_polygon
return_type: Geometry return_type: Geometry
params: params:
- { name: postal_code, type: integer} - { name: postal_code, type: double precision}
- { name: country_name, type: text} - { name: country_name, type: text}
- name: cdb_geocode_postalcode_point - name: cdb_geocode_postalcode_point
@ -54,7 +54,7 @@
- name: cdb_geocode_postalcode_point - name: cdb_geocode_postalcode_point
return_type: Geometry return_type: Geometry
params: params:
- { name: postal_code, type: integer} - { name: postal_code, type: double precision}
- { name: country_name, type: text} - { name: country_name, type: text}
- name: cdb_geocode_ipaddress_point - name: cdb_geocode_ipaddress_point

View File

@ -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 $$ RETURNS Geometry AS $$
SELECT cdb_dataservices_server.cdb_geocode_postalcode_point(username, orgname, code::text); SELECT cdb_dataservices_server.cdb_geocode_postalcode_point(username, orgname, code::text);
$$ LANGUAGE SQL; $$ LANGUAGE SQL;
@ -40,7 +40,7 @@ RETURNS Geometry AS $$
$$ LANGUAGE plpythonu; $$ 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 $$ RETURNS Geometry AS $$
SELECT cdb_dataservices_server.cdb_geocode_postalcode_point(username, orgname, code::text, country) SELECT cdb_dataservices_server.cdb_geocode_postalcode_point(username, orgname, code::text, country)
$$ LANGUAGE SQL; $$ LANGUAGE SQL;
@ -82,7 +82,7 @@ RETURNS Geometry AS $$
$$ LANGUAGE plpythonu; $$ 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 $$ RETURNS Geometry AS $$
SELECT cdb_dataservices_server.cdb_geocode_postalcode_polygon(username, orgname, code::text) SELECT cdb_dataservices_server.cdb_geocode_postalcode_polygon(username, orgname, code::text)
$$ LANGUAGE SQL; $$ LANGUAGE SQL;
@ -124,7 +124,7 @@ RETURNS Geometry AS $$
$$ LANGUAGE plpythonu; $$ 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 $$ RETURNS Geometry AS $$
SELECT cdb_dataservices_server.cdb_geocode_postalcode_polygon(username, orgname, code::text, country) SELECT cdb_dataservices_server.cdb_geocode_postalcode_polygon(username, orgname, code::text, country)
$$ LANGUAGE SQL; $$ LANGUAGE SQL;