]> granicus.if.org Git - postgis/commitdiff
Tweaked UpdateRasterSRID() to drop/add coverage tile as needed
authorBborie Park <bkpark at ucdavis.edu>
Tue, 18 Dec 2012 20:42:05 +0000 (20:42 +0000)
committerBborie Park <bkpark at ucdavis.edu>
Tue, 18 Dec 2012 20:42:05 +0000 (20:42 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@10853 b70326c6-7e19-0410-871a-916f4a2858ee

raster/rt_pg/rtpostgis.sql.in.c

index 6c0ea61aff469d2dcb7d4b770d932d788cb88012..e3c38b6a5d4480f26f248d59cbe2947b29d4898e 100644 (file)
@@ -7801,6 +7801,7 @@ CREATE OR REPLACE FUNCTION _UpdateRasterSRID(
                schema name;
                sql text;
                srid integer;
+               ct boolean;
        BEGIN
                -- validate schema
                schema := NULL;
@@ -7841,6 +7842,13 @@ CREATE OR REPLACE FUNCTION _UpdateRasterSRID(
                        srid := new_srid;
                END IF;
 
+               -- drop coverage tile constraint
+               -- done separately just in case constraint doesn't exist
+               ct := _raster_constraint_info_coverage_tile(schema, $2, $3);
+               IF ct IS TRUE THEN
+                       PERFORM _drop_raster_constraint_coverage_tile(schema, $2, $3);
+               END IF;
+
                -- drop SRID, extent, alignment constraints
                PERFORM DropRasterConstraints(schema, $2, $3, 'extent', 'alignment', 'srid');
 
@@ -7861,6 +7869,11 @@ CREATE OR REPLACE FUNCTION _UpdateRasterSRID(
                -- add SRID constraint
                PERFORM AddRasterConstraints(schema, $2, $3, 'srid', 'extent', 'alignment');
 
+               -- add coverage tile constraint if needed
+               IF ct IS TRUE THEN
+                       PERFORM _add_raster_constraint_coverage_tile(schema, $2, $3);
+               END IF;
+
                RETURN TRUE;
        END;
        $$ LANGUAGE 'plpgsql' VOLATILE;