From: Bborie Park Date: Wed, 17 Oct 2012 14:29:42 +0000 (+0000) Subject: Add fallback method of getting maximum extent for extent constraint. X-Git-Tag: 2.1.0beta2~517 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c9e436d70dd18372dfd6919d2ae2b3d437db31a9;p=postgis 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 --- 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