3c60f3e93b
Make sure we return an empty record and that the mentioned code is never reached.
57 lines
3.1 KiB
Plaintext
57 lines
3.1 KiB
Plaintext
SET client_min_messages TO warning;
|
|
SET search_path TO public,cartodb,cdb_dataservices_client;
|
|
-- Mock the server functions to raise exceptions
|
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_geocode_street_point (username text, orgname text, searchtext text, city text DEFAULT NULL, state_province text DEFAULT NULL, country text DEFAULT NULL)
|
|
RETURNS Geometry AS $$
|
|
BEGIN
|
|
RAISE EXCEPTION 'Not enough quota or any other exception whatsoever.';
|
|
RETURN NULL;
|
|
END;
|
|
$$ LANGUAGE 'plpgsql';
|
|
CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_isodistance(username text, orgname text, source geometry, mode text, range integer[], options text[] DEFAULT ARRAY[]::text[])
|
|
RETURNS SETOF isoline AS $$
|
|
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
|
|
SELECT _cdb_geocode_street_point_exception_safe('One street, 1');
|
|
WARNING: cdb_dataservices_client._cdb_geocode_street_point(6): [contrib_regression] REMOTE ERROR: Not enough quota or any other exception whatsoever.
|
|
DETAIL: SQL statement "SELECT cdb_dataservices_client._cdb_geocode_street_point(username, orgname, searchtext, city, state_province, country)"
|
|
PL/pgSQL function _cdb_geocode_street_point_exception_safe(text,text,text,text) line 21 at SQL statement
|
|
_cdb_geocode_street_point_exception_safe
|
|
------------------------------------------
|
|
|
|
(1 row)
|
|
|
|
SELECT * FROM _cdb_isodistance_exception_safe('POINT(-3.70568 40.42028)'::geometry, 'walk', ARRAY[300]::integer[]);
|
|
WARNING: cdb_dataservices_client._cdb_isodistance(6): [contrib_regression] REMOTE ERROR: Not enough quota or any other exception whatsoever.
|
|
DETAIL: PL/pgSQL function _cdb_isodistance_exception_safe(geometry,text,integer[],text[]) line 21 at RETURN QUERY
|
|
center | data_range | the_geom
|
|
--------+------------+----------
|
|
(0 rows)
|
|
|
|
SELECT * 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 | length | duration
|
|
-------+--------+----------
|
|
| |
|
|
(1 row)
|
|
|