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

Paul Ramsey pramsey at cleverelephant.ca
Mon May 7 11:46:44 PDT 2018


Author: pramsey
Date: 2018-05-07 11:46:44 -0700 (Mon, 07 May 2018)
New Revision: 16561

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


Modified: trunk/postgis/lwgeom_geos.c
===================================================================
--- trunk/postgis/lwgeom_geos.c	2018-05-07 18:19:21 UTC (rev 16560)
+++ trunk/postgis/lwgeom_geos.c	2018-05-07 18:46:44 UTC (rev 16561)
@@ -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