Commit 1ec419ac authored by Regina Obe's avatar Regina Obe

Make _drop_raster_constraint_spatially_unique and...

Make _drop_raster_constraint_spatially_unique and _raster_constraint_info_spatially_unique allow for presence or absense of schema qual on geometry cast.  
Was failing before when installed as extension (but not by script)
Reference #4291 for PostGIS 2.5.2


git-svn-id: http://svn.osgeo.org/postgis/branches/2.5@17321 b70326c6-7e19-0410-871a-916f4a2858ee
parent 441b53cf
Pipeline #51140159 passed with stage
in 23 minutes and 3 seconds
...@@ -7584,7 +7584,7 @@ CREATE OR REPLACE FUNCTION _raster_constraint_info_spatially_unique(rastschema n ...@@ -7584,7 +7584,7 @@ CREATE OR REPLACE FUNCTION _raster_constraint_info_spatially_unique(rastschema n
AND s.contype = 'x' AND s.contype = 'x'
AND 0::smallint = ANY (s.conkey) AND 0::smallint = ANY (s.conkey)
AND idx.indexrelid = s.conindid AND idx.indexrelid = s.conindid
AND pg_get_indexdef(idx.indexrelid, 1, true) LIKE '(' || quote_ident($3) || '::@extschema@.geometry)' AND pg_get_indexdef(idx.indexrelid, 1, true) LIKE '(' || quote_ident($3) || '::%geometry)'
AND s.conexclop[1] = op.oid AND s.conexclop[1] = op.oid
AND op.oprname = '='; AND op.oprname = '=';
$$ LANGUAGE sql STABLE STRICT $$ LANGUAGE sql STABLE STRICT
...@@ -7635,7 +7635,7 @@ CREATE OR REPLACE FUNCTION _drop_raster_constraint_spatially_unique(rastschema n ...@@ -7635,7 +7635,7 @@ CREATE OR REPLACE FUNCTION _drop_raster_constraint_spatially_unique(rastschema n
AND s.contype = 'x' AND s.contype = 'x'
AND 0::smallint = ANY (s.conkey) AND 0::smallint = ANY (s.conkey)
AND idx.indexrelid = s.conindid AND idx.indexrelid = s.conindid
AND pg_get_indexdef(idx.indexrelid, 1, true) LIKE '(' || quote_ident($3) || '::@extschema@.geometry)' AND pg_get_indexdef(idx.indexrelid, 1, true) LIKE '(' || quote_ident($3) || '::%geometry)'
AND s.conexclop[1] = op.oid AND s.conexclop[1] = op.oid
AND op.oprname = '='; AND op.oprname = '=';
...@@ -7686,7 +7686,7 @@ CREATE OR REPLACE FUNCTION _add_raster_constraint_coverage_tile(rastschema name, ...@@ -7686,7 +7686,7 @@ CREATE OR REPLACE FUNCTION _add_raster_constraint_coverage_tile(rastschema name,
END IF; END IF;
fqtn := fqtn || quote_ident($2); fqtn := fqtn || quote_ident($2);
cn := 'enforce_coverage_tile_' || $3; cn := 'enforce_coverage_tile_' || quote_ident($3);
-- metadata -- metadata
BEGIN BEGIN
......
...@@ -104,7 +104,7 @@ SELECT make_test_raster(4, 3, 3, 3, 3); ...@@ -104,7 +104,7 @@ SELECT make_test_raster(4, 3, 3, 3, 3);
SELECT AddRasterConstraints(current_schema(), 'test_raster_columns', 'rast'::name); SELECT AddRasterConstraints(current_schema(), 'test_raster_columns', 'rast'::name);
SELECT AddRasterConstraints(current_schema(), 'test_raster_columns', 'rast'::name, 'regular_blocking'); SELECT AddRasterConstraints(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'; SELECT '#1', 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';
-- spatially unique, this should fail -- spatially unique, this should fail
SELECT make_test_raster(0, 3, 3, 0, 0); SELECT make_test_raster(0, 3, 3, 0, 0);
...@@ -113,7 +113,7 @@ SELECT make_test_raster(0, 3, 3, 0, 0); ...@@ -113,7 +113,7 @@ SELECT make_test_raster(0, 3, 3, 0, 0);
SELECT make_test_raster(0, 3, 3, 1, 0); SELECT make_test_raster(0, 3, 3, 1, 0);
SELECT DropRasterConstraints(current_schema(), 'test_raster_columns', 'rast'::name, 'regular_blocking'); 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'; SELECT '#2', 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';
-- check spatial_index -- check spatial_index
SELECT SELECT
...@@ -138,8 +138,8 @@ FROM raster_columns WHERE r_table_name = 'test_raster_columns'; ...@@ -138,8 +138,8 @@ FROM raster_columns WHERE r_table_name = 'test_raster_columns';
-- ticket #2215 -- ticket #2215
CREATE TABLE test_raster_columns_2 AS CREATE TABLE test_raster_columns_2 AS
SELECT rid, rast FROM test_raster_columns; SELECT rid, rast FROM test_raster_columns;
SELECT AddRasterConstraints(current_schema(), 'test_raster_columns_2', 'rast'::name); SELECT '#2215-1', AddRasterConstraints(current_schema(), 'test_raster_columns_2', 'rast'::name);
SELECT AddRasterConstraints(current_schema(), 'test_raster_columns', 'rast'::name, 'regular_blocking'); SELECT '#2215-2', AddRasterConstraints(current_schema(), 'test_raster_columns', 'rast'::name, 'regular_blocking');
DROP TABLE IF EXISTS test_raster_columns_2; 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 FUNCTION make_test_raster(integer, integer, integer, double precision, double precision, double precision, double precision, double precision, double precision);
......
...@@ -14,10 +14,10 @@ test_raster_columns|rast|0|||2|2|t|f|1||{0}|POLYGON((-2 -2,-2 4,4 4,4 -2,-2 -2)) ...@@ -14,10 +14,10 @@ test_raster_columns|rast|0|||2|2|t|f|1||{0}|POLYGON((-2 -2,-2 4,4 4,4 -2,-2 -2))
t t
t t
t t
test_raster_columns|rast|0|1|1|3|3|t|t|1|{8BUI}|{0}|POLYGON((0 0,0 6,6 6,6 0,0 0)) #1|test_raster_columns|rast|0|1|1|3|3|t|t|1|{8BUI}|{0}|POLYGON((0 0,0 6,6 6,6 0,0 0))
ERROR: conflicting key value violates exclusion constraint "enforce_spatially_unique_test_raster_columns_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" ERROR: new row for relation "test_raster_columns" violates check constraint "enforce_coverage_tile_rast"
t t
test_raster_columns|rast|0|1|1|3|3|t|f|1|{8BUI}|{0}|POLYGON((0 0,0 6,6 6,6 0,0 0)) #2|test_raster_columns|rast|0|1|1|3|3|t|f|1|{8BUI}|{0}|POLYGON((0 0,0 6,6 6,6 0,0 0))
t #2215-1|t
t #2215-2|t
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment