]> granicus.if.org Git - postgis/commitdiff
Move SPI_finish to after elog calls. This seems to fix the regression failure in...
authorPaul Ramsey <pramsey@cleverelephant.ca>
Thu, 22 Dec 2011 05:48:52 +0000 (05:48 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Thu, 22 Dec 2011 05:48:52 +0000 (05:48 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@8498 b70326c6-7e19-0410-871a-916f4a2858ee

postgis/geometry_estimate.c

index a0ea962073ae13219a8615e835fefa09eac63a6e..1f5a59e31c1805d2c3b801128558ad12f38a8d31 100644 (file)
@@ -1408,8 +1408,8 @@ Datum geometry_estimated_extent(PG_FUNCTION_ARGS)
        SPIcode = SPI_exec(query, 1);
        if (SPIcode != SPI_OK_SELECT)
        {
-               SPI_finish();
                elog(ERROR, "geometry_estimated_extent: couldn't execute permission check sql via SPI");
+               SPI_finish();
                PG_RETURN_NULL();
        }
 
@@ -1419,8 +1419,8 @@ Datum geometry_estimated_extent(PG_FUNCTION_ARGS)
 
        if (!DatumGetBool(SPI_getbinval(tuple, tupdesc, 1, &isnull)))
        {
-               SPI_finish();
                elog(ERROR, "geometry_estimated_extent: permission denied for relation %s", tbl);
+               SPI_finish();
                PG_RETURN_NULL();
        }
 
@@ -1440,23 +1440,22 @@ Datum geometry_estimated_extent(PG_FUNCTION_ARGS)
        SPIcode = SPI_exec(query, 1);
        if (SPIcode != SPI_OK_SELECT )
        {
-               SPI_finish();
                elog(ERROR,"geometry_estimated_extent: couldnt execute sql via SPI");
+               SPI_finish();
                PG_RETURN_NULL();
        }
        if (SPI_processed != 1)
        {
-               SPI_finish();
 
                POSTGIS_DEBUGF(3, " %d stat rows", SPI_processed);
 
                /* 
                 * TODO: distinguish between empty and not analyzed ?
                 */
-               elog(WARNING, "No stats for \"%s\".\"%s\".\"%s\" "
-                       "(empty or not analyzed)",
+               elog(WARNING, "No stats for \"%s\".\"%s\".\"%s\" (empty or not analyzed)",
                        ( nsp ? nsp : "<current>" ), tbl, col);
 
+               SPI_finish();
                PG_RETURN_NULL() ;
        }
 
@@ -1466,12 +1465,12 @@ Datum geometry_estimated_extent(PG_FUNCTION_ARGS)
        array = DatumGetArrayTypeP(SPI_getbinval(tuple, tupdesc, 1, &isnull));
        if (isnull)
        {
-               SPI_finish();
 
                POSTGIS_DEBUG(3, " stats are NULL");
 
                elog(ERROR, "geometry_estimated_extent: null statistics for table");
 
+               SPI_finish();
                PG_RETURN_NULL();
        }
        if ( ArrayGetNItems(ARR_NDIM(array), ARR_DIMS(array)) != 4 )