rasters in ST_Tile()
- #2203, Changed how rasters with unknown SRID and default geotransform
are handled when passing to GDAL Warp API
+ - #2215, Fixed raster exclusion constraint for conflicting name of
+ implicit index
PostGIS 2.0.3
2013/MM/DD
END IF;
fqtn := fqtn || quote_ident($2);
- cn := 'enforce_spatially_unique_' || $3;
+ cn := 'enforce_spatially_unique_' || quote_ident($2) || '_'|| $3;
sql := 'ALTER TABLE ' || fqtn ||
' ADD CONSTRAINT ' || quote_ident(cn) ||
COST 100;
CREATE OR REPLACE FUNCTION _drop_raster_constraint_spatially_unique(rastschema name, rasttable name, rastcolumn name)
- RETURNS boolean AS
- $$ SELECT _drop_raster_constraint($1, $2, 'enforce_spatially_unique_' || $3) $$
- LANGUAGE 'sql' VOLATILE STRICT
+ RETURNS boolean AS $$
+ DECLARE
+ cn text;
+ BEGIN
+ SELECT
+ s.conname INTO cn
+ FROM pg_class c, pg_namespace n, pg_attribute a, pg_constraint s, pg_index idx, pg_operator op
+ WHERE n.nspname = $1
+ AND c.relname = $2
+ AND a.attname = $3
+ AND a.attrelid = c.oid
+ AND s.connamespace = n.oid
+ AND s.conrelid = c.oid
+ AND s.contype = 'x'
+ AND 0::smallint = ANY (s.conkey)
+ AND idx.indexrelid = s.conindid
+ AND pg_get_indexdef(idx.indexrelid, 1, true) LIKE '(' || quote_ident($3) || '::geometry)'
+ AND s.conexclop[1] = op.oid
+ AND op.oprname = '=';
+
+ RETURN _drop_raster_constraint($1, $2, cn);
+ END;
+ $$ LANGUAGE 'plpgsql' VOLATILE STRICT
COST 100;
CREATE OR REPLACE FUNCTION _raster_constraint_info_coverage_tile(rastschema name, rasttable name, rastcolumn name)
SELECT DropRasterConstraints(current_schema(), 'test_raster_columns', 'rast'::name, 'regular_blocking');
SELECT r_table_name, r_raster_column, srid, scale_x, scale_y, blocksize_x, blocksize_y, same_alignment, regular_blocking, num_bands, pixel_types, nodata_values, ST_AsEWKT(extent) FROM raster_columns WHERE r_table_name = 'test_raster_columns';
+-- ticket #2215
+CREATE TABLE test_raster_columns_2 AS
+ SELECT rid, rast FROM test_raster_columns;
+SELECT AddRasterConstraints(current_schema(), 'test_raster_columns_2', 'rast'::name);
+SELECT AddRasterConstraints(current_schema(), 'test_raster_columns', 'rast'::name, 'regular_blocking');
+DROP TABLE IF EXISTS test_raster_columns_2;
+
DROP FUNCTION make_test_raster(integer, integer, integer, double precision, double precision, double precision, double precision, double precision, double precision);
DROP TABLE IF EXISTS test_raster_columns;
t
t
test_raster_columns|rast|0|1|1|3|3|t|t|1|{8BUI}|{0}|POLYGON((3 0,0 0,0 3,0 6,3 6,6 6,6 3,6 0,3 0))
-ERROR: conflicting key value violates exclusion constraint "enforce_spatially_unique_rast"
+ERROR: conflicting key value violates exclusion constraint "enforce_spatially_unique_test_raster_columns_rast"
ERROR: new row for relation "test_raster_columns" violates check constraint "enforce_coverage_tile_rast"
t
test_raster_columns|rast|0|1|1|3|3|t|f|1|{8BUI}|{0}|POLYGON((3 0,0 0,0 3,0 6,3 6,6 6,6 3,6 0,3 0))
+t
+t