From 8692fb12cae38b01d6bbe8d85582c94f533788b5 Mon Sep 17 00:00:00 2001 From: Rafa de la Torre Date: Wed, 14 Dec 2016 12:57:51 +0100 Subject: [PATCH] Add test case for multi_field #314 --- ..._exception_safe_private_functions_test.out | 21 +++++++++++++++++++ ..._exception_safe_private_functions_test.sql | 15 +++++++++++++ 2 files changed, 36 insertions(+) diff --git a/client/test/expected/25_exception_safe_private_functions_test.out b/client/test/expected/25_exception_safe_private_functions_test.out index de19bd2..f7a6c97 100644 --- a/client/test/expected/25_exception_safe_private_functions_test.out +++ b/client/test/expected/25_exception_safe_private_functions_test.out @@ -14,6 +14,18 @@ BEGIN RAISE EXCEPTION 'Not enough quota or any other exception whatsoever.'; END; $$ LANGUAGE 'plpgsql'; +CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point (username text, orgname text, origin geometry(Point, 4326), destination geometry(Point, 4326), mode TEXT, options text[] DEFAULT ARRAY[]::text[], units text DEFAULT 'kilometers') +RETURNS cdb_dataservices_client.simple_route AS $$ +DECLARE + ret cdb_dataservices_client.simple_route; +BEGIN + RAISE EXCEPTION 'Not enough quota or any other exception whatsoever.'; + + -- This code shall never be reached + SELECT NULL, 5.33, 100 INTO ret; + RETURN ret; +END; +$$ LANGUAGE 'plpgsql'; -- Use regular user role SET ROLE test_regular_user; -- Exercise the exception safe and the proxied functions @@ -33,3 +45,12 @@ DETAIL: PL/pgSQL function _cdb_isodistance_exception_safe(geometry,text,integer ---------- (0 rows) +SELECT shape FROM _cdb_route_point_to_point_exception_safe('POINT(-3.70237112 40.41706163)'::geometry,'POINT(-3.69909883 40.41236875)'::geometry, 'car', ARRAY['mode_type=shortest']::text[]); +WARNING: cdb_dataservices_client._cdb_route_point_to_point(7): [contrib_regression] REMOTE ERROR: Not enough quota or any other exception whatsoever. +DETAIL: SQL statement "SELECT * FROM cdb_dataservices_client._cdb_route_point_to_point(username, orgname, origin, destination, mode, options, units)" +PL/pgSQL function _cdb_route_point_to_point_exception_safe(geometry,geometry,text,text[],text) line 21 at SQL statement + shape +------- + +(1 row) + diff --git a/client/test/sql/25_exception_safe_private_functions_test.sql b/client/test/sql/25_exception_safe_private_functions_test.sql index c48a465..98fce99 100644 --- a/client/test/sql/25_exception_safe_private_functions_test.sql +++ b/client/test/sql/25_exception_safe_private_functions_test.sql @@ -17,6 +17,20 @@ BEGIN END; $$ LANGUAGE 'plpgsql'; +CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_route_point_to_point (username text, orgname text, origin geometry(Point, 4326), destination geometry(Point, 4326), mode TEXT, options text[] DEFAULT ARRAY[]::text[], units text DEFAULT 'kilometers') +RETURNS cdb_dataservices_client.simple_route AS $$ +DECLARE + ret cdb_dataservices_client.simple_route; +BEGIN + RAISE EXCEPTION 'Not enough quota or any other exception whatsoever.'; + + -- This code shall never be reached + SELECT NULL, 5.33, 100 INTO ret; + RETURN ret; +END; +$$ LANGUAGE 'plpgsql'; + + -- Use regular user role SET ROLE test_regular_user; @@ -24,3 +38,4 @@ SET ROLE test_regular_user; -- Exercise the exception safe and the proxied functions SELECT _cdb_geocode_street_point_exception_safe('One street, 1'); SELECT the_geom FROM _cdb_isodistance_exception_safe('POINT(-3.70568 40.42028)'::geometry, 'walk', ARRAY[300]::integer[]); +SELECT shape FROM _cdb_route_point_to_point_exception_safe('POINT(-3.70237112 40.41706163)'::geometry,'POINT(-3.69909883 40.41236875)'::geometry, 'car', ARRAY['mode_type=shortest']::text[]);