From f63d73b9d78071cceeafe583ebb104a2a718bb71 Mon Sep 17 00:00:00 2001 From: Rafa de la Torre Date: Tue, 19 Feb 2019 12:27:29 +0100 Subject: [PATCH] Fix the bulk geocoding when soft_limit is enabled Fix the case where there's not enough quota to geocode a table but the soft_limit is set to true. The function `cdb_enough_quota` accounts for the `soft_limit` flag, as well as for the remaining quota and the rows to be geocoded. --- client/sql/21_bulk_geocoding_functions.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/sql/21_bulk_geocoding_functions.sql b/client/sql/21_bulk_geocoding_functions.sql index 84168fd..38a0ded 100644 --- a/client/sql/21_bulk_geocoding_functions.sql +++ b/client/sql/21_bulk_geocoding_functions.sql @@ -49,7 +49,7 @@ BEGIN RAISE DEBUG 'cdb_bulk_geocode_street_point --> query_row_count: %; query: %; country: %; state: %; city: %; street: %', query_row_count, query, country_column, state_column, city_column, street_column; SELECT cdb_dataservices_client.cdb_enough_quota('hires_geocoder', query_row_count) INTO enough_quota; - IF remaining_quota < query_row_count THEN + IF NOT enough_quota THEN RAISE EXCEPTION 'Remaining quota: %. Estimated cost: %', remaining_quota, query_row_count; END IF;