From c9e436d70dd18372dfd6919d2ae2b3d437db31a9 Mon Sep 17 00:00:00 2001 From: Bborie Park Date: Wed, 17 Oct 2012 14:29:42 +0000 Subject: [PATCH] Add fallback method of getting maximum extent for extent constraint. Ticket is #2050 git-svn-id: http://svn.osgeo.org/postgis/trunk@10455 b70326c6-7e19-0410-871a-916f4a2858ee --- raster/rt_pg/rtpostgis.sql.in.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/raster/rt_pg/rtpostgis.sql.in.c b/raster/rt_pg/rtpostgis.sql.in.c index 1d496a557..23fe8b188 100644 --- a/raster/rt_pg/rtpostgis.sql.in.c +++ b/raster/rt_pg/rtpostgis.sql.in.c @@ -5896,8 +5896,18 @@ CREATE OR REPLACE FUNCTION _add_raster_constraint_extent(rastschema name, rastta BEGIN EXECUTE sql INTO attr; EXCEPTION WHEN OTHERS THEN - RAISE NOTICE 'Unable to get the extent of a sample raster'; - RETURN FALSE; + RAISE NOTICE 'Unable to get the extent of a sample raster. Attempting memory efficient (slower) approach'; + + sql := 'SELECT st_ashexewkb(st_convexhull(st_memunion(st_convexhull(' + || quote_ident($3) + || ')))) FROM ' + || fqtn; + BEGIN + EXECUTE sql INTO attr; + EXCEPTION WHEN OTHERS THEN + RAISE NOTICE 'Still unable to get the extent of a sample raster. Cannot add extent constraint'; + RETURN FALSE; + END; END; sql := 'ALTER TABLE ' || fqtn -- 2.50.1