From: Bborie Park Date: Mon, 7 Jul 2014 15:39:14 +0000 (+0000) Subject: use @ operator instead of ST_CoveredBy(). Ticket #2822 X-Git-Tag: 2.2.0rc1~1001 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=74c692676071895437974657536e3c081afd0157;p=postgis use @ operator instead of ST_CoveredBy(). Ticket #2822 git-svn-id: http://svn.osgeo.org/postgis/trunk@12752 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/NEWS b/NEWS index dda9b5eeb..bc4680e75 100644 --- a/NEWS +++ b/NEWS @@ -80,6 +80,8 @@ PostGIS 2.2.0 like geometry extent - #2802, ST_MapAlgebra checks for valid callback function return value - #2803, ST_MapAlgebra handles no userarg and STRICT callback function + - #2822, Use @ operator instead of ST_CoveredBy() for raster + max extent constraint * Code refactoring * diff --git a/raster/rt_pg/rtpostgis.sql.in b/raster/rt_pg/rtpostgis.sql.in index 725d0f7c5..72285c7e1 100644 --- a/raster/rt_pg/rtpostgis.sql.in +++ b/raster/rt_pg/rtpostgis.sql.in @@ -7048,7 +7048,7 @@ CREATE OR REPLACE FUNCTION _drop_raster_constraint_blocksize(rastschema name, ra CREATE OR REPLACE FUNCTION _raster_constraint_info_extent(rastschema name, rasttable name, rastcolumn name) RETURNS geometry AS $$ SELECT - trim(both '''' from split_part(trim(split_part(s.consrc, ',', 2)), '::', 1))::geometry + trim(both '''' from split_part(trim(split_part(s.consrc, ' @ ', 2)), '::', 1))::geometry FROM pg_class c, pg_namespace n, pg_attribute a, pg_constraint s WHERE n.nspname = $1 AND c.relname = $2 @@ -7057,7 +7057,7 @@ CREATE OR REPLACE FUNCTION _raster_constraint_info_extent(rastschema name, rastt AND s.connamespace = n.oid AND s.conrelid = c.oid AND a.attnum = ANY (s.conkey) - AND s.consrc LIKE '%st_coveredby(st_envelope(%'; + AND s.consrc LIKE '%st_envelope(% @ %'; $$ LANGUAGE sql STABLE STRICT COST 100; @@ -7085,9 +7085,9 @@ CREATE OR REPLACE FUNCTION _add_raster_constraint_extent(rastschema name, rastta sql := 'ALTER TABLE ' || fqtn || ' ADD CONSTRAINT ' || quote_ident(cn) - || ' CHECK (st_coveredby(st_envelope(' + || ' CHECK (st_envelope(' || quote_ident($3) - || '), ''' || attr || '''::geometry))'; + || ') @ ''' || attr || '''::geometry)'; RETURN _add_raster_constraint(cn, sql); END; $$ LANGUAGE 'plpgsql' VOLATILE STRICT