[postgis-tickets] r16562 - Emit a cancellation error code on GEOS interruptedExceptions, for consistency

Paul Ramsey pramsey at cleverelephant.ca
Mon May 7 11:47:53 PDT 2018


Author: pramsey
Date: 2018-05-07 11:47:53 -0700 (Mon, 07 May 2018)
New Revision: 16562

Modified:
   branches/2.4/NEWS
   branches/2.4/postgis/lwgeom_geos.c
Log:
Emit a cancellation error code on GEOS interruptedExceptions, for consistency
with internal interruptions.
Closes #4070


Modified: branches/2.4/NEWS
===================================================================
--- branches/2.4/NEWS	2018-05-07 18:46:44 UTC (rev 16561)
+++ branches/2.4/NEWS	2018-05-07 18:47:53 UTC (rev 16562)
@@ -5,6 +5,7 @@
 
   - #4071, ST_ClusterKMeans crash on NULL/EMPTY fixed (Darafei Praliaskouski)
   - #4079, ensure St_AsMVTGeom outputs CW oriented polygons (Paul Ramsey)
+  - #4070, use standard interruption error code on GEOS interruptions (Paul Ramsey)
 
 
 PostGIS 2.4.4

Modified: branches/2.4/postgis/lwgeom_geos.c
===================================================================
--- branches/2.4/postgis/lwgeom_geos.c	2018-05-07 18:46:44 UTC (rev 16561)
+++ branches/2.4/postgis/lwgeom_geos.c	2018-05-07 18:47:53 UTC (rev 16562)
@@ -54,8 +54,10 @@
  * case we let PostgreSQL deal with the error.
  */
 #define HANDLE_GEOS_ERROR(label) { \
-  if ( ! strstr(lwgeom_geos_errmsg, "InterruptedException") ) \
-    lwpgerror(label": %s", lwgeom_geos_errmsg); \
+  if (strstr(lwgeom_geos_errmsg, "InterruptedException")) \
+    ereport(ERROR, (errcode(ERRCODE_QUERY_CANCELED), errmsg("canceling statement due to user request"))); \
+  else \
+    lwpgerror(label ": %s", lwgeom_geos_errmsg); \
   PG_RETURN_NULL(); \
 }
 



More information about the postgis-tickets mailing list