[postgis-tickets] r16991 - Schema qualify some missed calls in raster plpgsql/sql functions
Regina Obe
lr at pcorp.us
Wed Nov 7 08:27:33 PST 2018
Author: robe
Date: 2018-11-07 08:27:33 -0800 (Wed, 07 Nov 2018)
New Revision: 16991
Modified:
branches/2.5/NEWS
branches/2.5/raster/rt_pg/rtpostgis.sql.in
Log:
Schema qualify some missed calls in raster plpgsql/sql functions
Modified: branches/2.5/NEWS
===================================================================
--- branches/2.5/NEWS 2018-11-07 15:41:34 UTC (rev 16990)
+++ branches/2.5/NEWS 2018-11-07 16:27:33 UTC (rev 16991)
@@ -15,6 +15,7 @@
- #4217, Fix ST_Subdivide crash on EMPTY in intermediate iterations (Darafei
Praliaskouski)
- #4223, ST_DistanceTree error for near parallel boxes (Paul Ramsey)
+ - Schema qualify more functions for raster (Regina Obe)
PostGIS 2.5.0
Modified: branches/2.5/raster/rt_pg/rtpostgis.sql.in
===================================================================
--- branches/2.5/raster/rt_pg/rtpostgis.sql.in 2018-11-07 15:41:34 UTC (rev 16990)
+++ branches/2.5/raster/rt_pg/rtpostgis.sql.in 2018-11-07 16:27:33 UTC (rev 16991)
@@ -6290,16 +6290,16 @@
tile integer[];
edge integer[];
BEGIN
- IF NOT ST_SameAlignment(rast, coverage) THEN
+ IF NOT @extschema at .ST_SameAlignment(rast, coverage) THEN
RAISE NOTICE 'Raster and coverage are not aligned';
RETURN FALSE;
END IF;
- _rastmeta := ST_Metadata(rast);
- _covmeta := ST_Metadata(coverage);
+ _rastmeta := @extschema at .ST_Metadata(rast);
+ _covmeta := @extschema at .ST_Metadata(coverage);
-- get coverage grid coordinates of upper-left of rast
- cr := ST_WorldToRasterCoord(coverage, _rastmeta.upperleftx, _rastmeta.upperlefty);
+ cr := @extschema at .ST_WorldToRasterCoord(coverage, _rastmeta.upperleftx, _rastmeta.upperlefty);
-- rast is not part of coverage
IF
@@ -6417,18 +6417,18 @@
RETURNS boolean AS $$
DECLARE
hasnodata boolean := TRUE;
- _geom geometry;
+ _geom @extschema at .geometry;
BEGIN
- IF ST_SRID(rast) != ST_SRID(geom) THEN
+ IF @extschema at .ST_SRID(rast) != @extschema at .ST_SRID(geom) THEN
RAISE EXCEPTION 'Raster and geometry do not have the same SRID';
END IF;
- _geom := ST_ConvexHull(rast);
+ _geom := @extschema at .ST_ConvexHull(rast);
IF nband IS NOT NULL THEN
SELECT CASE WHEN bmd.nodatavalue IS NULL THEN FALSE ELSE NULL END INTO hasnodata FROM @extschema at .ST_BandMetaData(rast, nband) AS bmd;
END IF;
- IF ST_Intersects(geom, _geom) IS NOT TRUE THEN
+ IF @extschema at .ST_Intersects(geom, _geom) IS NOT TRUE THEN
RETURN FALSE;
ELSEIF nband IS NULL OR hasnodata IS FALSE THEN
RETURN TRUE;
@@ -6443,7 +6443,7 @@
-- This function can not be STRICT
CREATE OR REPLACE FUNCTION st_intersects(geom geometry, rast raster, nband integer DEFAULT NULL)
RETURNS boolean AS
- $$ SELECT $1 OPERATOR(@extschema at .&&) $2::geometry AND @extschema at ._st_intersects($1, $2, $3); $$
+ $$ SELECT $1 OPERATOR(@extschema at .&&) $2::@extschema at .geometry AND @extschema at ._st_intersects($1, $2, $3); $$
LANGUAGE 'sql' IMMUTABLE _PARALLEL
COST 1000;
@@ -6453,13 +6453,13 @@
CREATE OR REPLACE FUNCTION st_intersects(rast raster, geom geometry, nband integer DEFAULT NULL)
RETURNS boolean
- AS $$ SELECT $1::geometry OPERATOR(@extschema at .&&) $2 AND @extschema at ._st_intersects($2, $1, $3) $$
+ AS $$ SELECT $1::@extschema at .geometry OPERATOR(@extschema at .&&) $2 AND @extschema at ._st_intersects($2, $1, $3) $$
LANGUAGE 'sql' IMMUTABLE _PARALLEL
COST 1000;
CREATE OR REPLACE FUNCTION st_intersects(rast raster, nband integer, geom geometry)
RETURNS boolean
- AS $$ SELECT $1::geometry OPERATOR(@extschema at .&&) $3 AND @extschema at ._st_intersects($3, $1, $2) $$
+ AS $$ SELECT $1::@extschema at .geometry OPERATOR(@extschema at .&&) $3 AND @extschema at ._st_intersects($3, $1, $2) $$
LANGUAGE 'sql' IMMUTABLE _PARALLEL
COST 1000;
@@ -6629,7 +6629,7 @@
CREATE OR REPLACE FUNCTION ST_DWithin(rast1 raster, nband1 integer, rast2 raster, nband2 integer, distance double precision)
RETURNS boolean
- AS $$ SELECT $1::geometry OPERATOR(@extschema at .&&) ST_Expand(ST_ConvexHull($3), $5) AND $3::geometry OPERATOR(@extschema at .&&) ST_Expand(ST_ConvexHull($1), $5) AND CASE WHEN $2 IS NULL OR $4 IS NULL THEN @extschema at ._ST_dwithin(st_convexhull($1), st_convexhull($3), $5) ELSE @extschema at ._ST_dwithin($1, $2, $3, $4, $5) END $$
+ AS $$ SELECT $1::geometry OPERATOR(@extschema at .&&) @extschema at .ST_Expand(@extschema at .ST_ConvexHull($3), $5) AND $3::@extschema at .geometry OPERATOR(@extschema at .&&) @extschema at .ST_Expand(@extschema at .ST_ConvexHull($1), $5) AND CASE WHEN $2 IS NULL OR $4 IS NULL THEN @extschema at ._ST_dwithin(@extschema at .st_convexhull($1), @extschema at .st_convexhull($3), $5) ELSE @extschema at ._ST_dwithin($1, $2, $3, $4, $5) END $$
LANGUAGE 'sql' IMMUTABLE _PARALLEL
COST 1000;
@@ -6651,7 +6651,7 @@
CREATE OR REPLACE FUNCTION ST_DFullyWithin(rast1 raster, nband1 integer, rast2 raster, nband2 integer, distance double precision)
RETURNS boolean
- AS $$ SELECT $1::geometry OPERATOR(@extschema at .&&) @extschema at .ST_Expand(@extschema at .ST_ConvexHull($3), $5) AND $3::geometry OPERATOR(@extschema at .&&) @extschema at .ST_Expand(@extschema at .ST_ConvexHull($1), $5) AND CASE WHEN $2 IS NULL OR $4 IS NULL THEN @extschema at ._ST_DFullyWithin(@extschema at .ST_ConvexHull($1), @extschema at .ST_Convexhull($3), $5) ELSE @extschema at ._ST_DFullyWithin($1, $2, $3, $4, $5) END $$
+ AS $$ SELECT $1::@extschema at .geometry OPERATOR(@extschema at .&&) @extschema at .ST_Expand(@extschema at .ST_ConvexHull($3), $5) AND $3::@extschema at .geometry OPERATOR(@extschema at .&&) @extschema at .ST_Expand(@extschema at .ST_ConvexHull($1), $5) AND CASE WHEN $2 IS NULL OR $4 IS NULL THEN @extschema at ._ST_DFullyWithin(@extschema at .ST_ConvexHull($1), @extschema at .ST_Convexhull($3), $5) ELSE @extschema at ._ST_DFullyWithin($1, $2, $3, $4, $5) END $$
LANGUAGE 'sql' IMMUTABLE _PARALLEL
COST 1000;
@@ -6686,7 +6686,7 @@
DECLARE
intersects boolean := FALSE;
BEGIN
- intersects := ST_Intersects(geomin, rast, band);
+ intersects := @extschema at .ST_Intersects(geomin, rast, band);
IF intersects THEN
-- Return the intersections of the geometry with the vectorized parts of
-- the raster and the values associated with those parts, if really their
@@ -6697,12 +6697,12 @@
val
FROM (
SELECT
- ST_Intersection((gv).geom, geomin) AS intgeom,
+ @extschema at .ST_Intersection((gv).geom, geomin) AS intgeom,
(gv).val
- FROM ST_DumpAsPolygons(rast, band) gv
- WHERE ST_Intersects((gv).geom, geomin)
+ FROM @extschema at .ST_DumpAsPolygons(rast, band) gv
+ WHERE @extschema at .ST_Intersects((gv).geom, geomin)
) foo
- WHERE NOT ST_IsEmpty(intgeom);
+ WHERE NOT @extschema at .ST_IsEmpty(intgeom);
ELSE
-- If the geometry does not intersect with the raster, return an empty
-- geometry and a null value
@@ -6710,7 +6710,7 @@
SELECT
emptygeom,
NULL::float8
- FROM ST_GeomCollFromText('GEOMETRYCOLLECTION EMPTY', ST_SRID($1)) emptygeom;
+ FROM @extschema at .ST_GeomCollFromText('GEOMETRYCOLLECTION EMPTY', ST_SRID($1)) emptygeom;
END IF;
END;
$$
@@ -6781,7 +6781,7 @@
nodataval double precision
)
RETURNS raster AS
- $$ SELECT st_intersection($1, $2, $3, $4, $5, ARRAY[$6, $6]) $$
+ $$ SELECT @extschema at .st_intersection($1, $2, $3, $4, $5, ARRAY[$6, $6]) $$
LANGUAGE 'sql' IMMUTABLE _PARALLEL;
CREATE OR REPLACE FUNCTION st_intersection(
@@ -6790,7 +6790,7 @@
nodataval double precision[]
)
RETURNS raster AS
- $$ SELECT st_intersection($1, $2, $3, $4, 'BOTH', $5) $$
+ $$ SELECT @extschema at .st_intersection($1, $2, $3, $4, 'BOTH', $5) $$
LANGUAGE 'sql' IMMUTABLE _PARALLEL;
CREATE OR REPLACE FUNCTION st_intersection(
@@ -6799,7 +6799,7 @@
nodataval double precision
)
RETURNS raster AS
- $$ SELECT st_intersection($1, $2, $3, $4, 'BOTH', ARRAY[$5, $5]) $$
+ $$ SELECT @extschema at .st_intersection($1, $2, $3, $4, 'BOTH', ARRAY[$5, $5]) $$
LANGUAGE 'sql' IMMUTABLE _PARALLEL;
-- Variants without band number
@@ -6810,7 +6810,7 @@
nodataval double precision[] DEFAULT NULL
)
RETURNS raster AS
- $$ SELECT st_intersection($1, 1, $2, 1, $3, $4) $$
+ $$ SELECT @extschema at .st_intersection($1, 1, $2, 1, $3, $4) $$
LANGUAGE 'sql' IMMUTABLE _PARALLEL;
CREATE OR REPLACE FUNCTION st_intersection(
@@ -6820,7 +6820,7 @@
nodataval double precision
)
RETURNS raster AS
- $$ SELECT st_intersection($1, 1, $2, 1, $3, ARRAY[$4, $4]) $$
+ $$ SELECT @extschema at .st_intersection($1, 1, $2, 1, $3, ARRAY[$4, $4]) $$
LANGUAGE 'sql' IMMUTABLE _PARALLEL;
CREATE OR REPLACE FUNCTION st_intersection(
@@ -6829,7 +6829,7 @@
nodataval double precision[]
)
RETURNS raster AS
- $$ SELECT st_intersection($1, 1, $2, 1, 'BOTH', $3) $$
+ $$ SELECT @extschema at .st_intersection($1, 1, $2, 1, 'BOTH', $3) $$
LANGUAGE 'sql' IMMUTABLE _PARALLEL;
CREATE OR REPLACE FUNCTION st_intersection(
@@ -6838,7 +6838,7 @@
nodataval double precision
)
RETURNS raster AS
- $$ SELECT st_intersection($1, 1, $2, 1, 'BOTH', ARRAY[$3, $3]) $$
+ $$ SELECT @extschema at .st_intersection($1, 1, $2, 1, 'BOTH', ARRAY[$3, $3]) $$
LANGUAGE 'sql' IMMUTABLE _PARALLEL;
-----------------------------------------------------------------------
@@ -7057,7 +7057,7 @@
exclude_nodata_value boolean DEFAULT TRUE
)
RETURNS double precision
- AS $$ SELECT st_nearestvalue($1, $2, st_setsrid(st_makepoint(st_rastertoworldcoordx($1, $3, $4), st_rastertoworldcoordy($1, $3, $4)), st_srid($1)), $5) $$
+ AS $$ SELECT @extschema at .st_nearestvalue($1, $2, @extschema at .st_setsrid(@extschema at .st_makepoint(@extschema at .st_rastertoworldcoordx($1, $3, $4), @extschema at .st_rastertoworldcoordy($1, $3, $4)), @extschema at .st_srid($1)), $5) $$
LANGUAGE 'sql' IMMUTABLE STRICT _PARALLEL;
CREATE OR REPLACE FUNCTION st_nearestvalue(
@@ -7066,7 +7066,7 @@
exclude_nodata_value boolean DEFAULT TRUE
)
RETURNS double precision
- AS $$ SELECT st_nearestvalue($1, 1, st_setsrid(st_makepoint(st_rastertoworldcoordx($1, $2, $3), st_rastertoworldcoordy($1, $2, $3)), st_srid($1)), $4) $$
+ AS $$ SELECT @extschema at .st_nearestvalue($1, 1, @extschema at .st_setsrid(@extschema at .st_makepoint(@extschema at .st_rastertoworldcoordx($1, $2, $3), @extschema at .st_rastertoworldcoordy($1, $2, $3)), @extschema at .st_srid($1)), $4) $$
LANGUAGE 'sql' IMMUTABLE STRICT _PARALLEL;
-----------------------------------------------------------------------
@@ -7116,11 +7116,11 @@
wy double precision;
rtn double precision[][];
BEGIN
- IF (st_geometrytype($3) != 'ST_Point') THEN
+ IF (@extschema at .st_geometrytype($3) != 'ST_Point') THEN
RAISE EXCEPTION 'Attempting to get the neighbor of a pixel with a non-point geometry';
END IF;
- IF ST_SRID(rast) != ST_SRID(pt) THEN
+ IF @extschema at .ST_SRID(rast) != @extschema at .ST_SRID(pt) THEN
RAISE EXCEPTION 'Raster and geometry do not have the same SRID';
END IF;
@@ -7129,8 +7129,8 @@
SELECT @extschema at ._ST_neighborhood(
$1, $2,
- st_worldtorastercoordx(rast, wx, wy),
- st_worldtorastercoordy(rast, wx, wy),
+ @extschema at .st_worldtorastercoordx(rast, wx, wy),
+ @extschema at .st_worldtorastercoordy(rast, wx, wy),
$4, $5,
$6
) INTO rtn;
@@ -7145,7 +7145,7 @@
exclude_nodata_value boolean DEFAULT TRUE
)
RETURNS double precision[][]
- AS $$ SELECT st_neighborhood($1, 1, $2, $3, $4, $5) $$
+ AS $$ SELECT @extschema at .st_neighborhood($1, 1, $2, $3, $4, $5) $$
LANGUAGE 'sql' IMMUTABLE STRICT _PARALLEL;
------------------------------------------------------------------------------
@@ -7238,7 +7238,7 @@
cn := 'enforce_srid_' || $3;
- sql := 'SELECT st_srid('
+ sql := 'SELECT @extschema at .st_srid('
|| quote_ident($3)
|| ') FROM ' || fqtn
|| ' LIMIT 1';
@@ -7252,7 +7252,7 @@
sql := 'ALTER TABLE ' || fqtn
|| ' ADD CONSTRAINT ' || quote_ident(cn)
- || ' CHECK (st_srid('
+ || ' CHECK (@extschema at .st_srid('
|| quote_ident($3)
|| ') = ' || attr || ')';
@@ -7318,7 +7318,7 @@
cn := 'enforce_scale' || $4 || '_' || $3;
- sql := 'SELECT st_scale' || $4 || '('
+ sql := 'SELECT @extschema at .st_scale' || $4 || '('
|| quote_ident($3)
|| ') FROM '
|| fqtn
@@ -7333,7 +7333,7 @@
sql := 'ALTER TABLE ' || fqtn
|| ' ADD CONSTRAINT ' || quote_ident(cn)
- || ' CHECK (round(st_scale' || $4 || '('
+ || ' CHECK (round(@extschema at .st_scale' || $4 || '('
|| quote_ident($3)
|| ')::numeric, 10) = round(' || text(attr) || '::numeric, 10))';
RETURN @extschema at ._add_raster_constraint(cn, sql);
@@ -7596,7 +7596,7 @@
sql := 'ALTER TABLE ' || fqtn ||
' ADD CONSTRAINT ' || quote_ident(cn) ||
- ' EXCLUDE ((' || quote_ident($3) || '::geometry) WITH =)';
+ ' EXCLUDE ((' || quote_ident($3) || '::@extschema at .geometry) WITH =)';
RETURN @extschema at ._add_raster_constraint(cn, sql);
END;
$$ LANGUAGE 'plpgsql' VOLATILE STRICT
@@ -7690,7 +7690,7 @@
END IF;
-- remove band
- _covrast := ST_MakeEmptyRaster(_covrast);
+ _covrast := @extschema at .ST_MakeEmptyRaster(_covrast);
EXCEPTION WHEN OTHERS THEN
RAISE NOTICE 'Unable to create coverage raster. Cannot add coverage tile constraint: % (%)',
SQLERRM, SQLSTATE;
@@ -7862,7 +7862,7 @@
sql := 'ALTER TABLE ' || fqtn
|| ' ADD CONSTRAINT ' || quote_ident(cn)
- || ' CHECK (_raster_constraint_pixel_types(' || quote_ident($3)
+ || ' CHECK (@extschema at ._raster_constraint_pixel_types(' || quote_ident($3)
|| ') = ''{';
FOR x in 1..max LOOP
sql := sql || '"' || attr[x] || '"';
@@ -8992,7 +8992,7 @@
ipy FLOAT8;
tx int;
ty int;
- te GEOMETRY; -- tile extent
+ te @extschema at .GEOMETRY; -- tile extent
ncols int;
nlins int;
srid int;
@@ -9002,17 +9002,17 @@
RAISE DEBUG 'Target coverage will have sfx=%, sfy=%', sfx, sfy;
-- 2. Loop over each target tile and build it from source tiles
- ipx := st_xmin(ext);
+ ipx := @extschema at .st_xmin(ext);
ncols := ceil((st_xmax(ext)-ipx)/sfx/tw);
IF sfy < 0 THEN
- ipy := st_ymax(ext);
- nlins := ceil((st_ymin(ext)-ipy)/sfy/th);
+ ipy := @extschema at .st_ymax(ext);
+ nlins := ceil((@extschema at .st_ymin(ext)-ipy)/sfy/th);
ELSE
- ipy := st_ymin(ext);
- nlins := ceil((st_ymax(ext)-ipy)/sfy/th);
+ ipy := @extschema at .st_ymin(ext);
+ nlins := ceil((@extschema at .st_ymax(ext)-ipy)/sfy/th);
END IF;
- srid := ST_Srid(ext);
+ srid := @extschema at .ST_Srid(ext);
RAISE DEBUG 'Target coverage will have % x % tiles, each of approx size % x %', ncols, nlins, tw, th;
RAISE DEBUG 'Target coverage will cover extent %', ext::box2d;
@@ -9019,7 +9019,7 @@
FOR tx IN 0..ncols-1 LOOP
FOR ty IN 0..nlins-1 LOOP
- te := ST_MakeEnvelope(ipx + tx * tw * sfx,
+ te := @extschema at .ST_MakeEnvelope(ipx + tx * tw * sfx,
ipy + ty * th * sfy,
ipx + (tx+1) * tw * sfx,
ipy + (ty+1) * th * sfy,
@@ -9093,7 +9093,7 @@
ttab := 'o_' || factor || '_' || sinfo.tab;
sql := 'CREATE TABLE ' || quote_ident(sinfo.sch)
|| '.' || quote_ident(ttab)
- || ' AS SELECT ST_Retile($1, $2, $3, $4, $5, $6, $7) '
+ || ' AS SELECT @extschema at .ST_Retile($1, $2, $3, $4, $5, $6, $7) '
|| quote_ident(col);
EXECUTE sql USING tab, col, sinfo.ext,
sinfo.sfx * factor, sinfo.sfy * factor,
@@ -9121,7 +9121,7 @@
rh int; -- raster height (may change at edges)
x int; -- x index of coverage
y int; -- y index of coverage
- template raster; -- an empty template raster, where each cell
+ template @extschema at .raster; -- an empty template raster, where each cell
-- represents a tile in the coverage
minY double precision;
maxX double precision;
More information about the postgis-tickets
mailing list