]> granicus.if.org Git - postgis/commitdiff
Fix PLPGSQL functions missing the schema qualification
authorRaúl Marín Rodríguez <rmrodriguez@carto.com>
Fri, 18 Oct 2019 16:22:30 +0000 (16:22 +0000)
committerRaúl Marín Rodríguez <rmrodriguez@carto.com>
Fri, 18 Oct 2019 16:22:30 +0000 (16:22 +0000)
References #4546

git-svn-id: http://svn.osgeo.org/postgis/branches/3.0@17976 b70326c6-7e19-0410-871a-916f4a2858ee

NEWS
postgis/geography.sql.in
postgis/postgis.sql.in
raster/rt_pg/rtpostgis.sql.in

diff --git a/NEWS b/NEWS
index 97534ae0c8fa83a9867f574f6afe25a862890fee..1857a7a87281dac6b34b5827a79e100cf515fbbc 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,7 @@ Additional performance enhancements if running GEOS 3.8+
   - #4537, Fix leak in WKT collection parser (Raúl Marín)
   - #4535, WKB: Avoid buffer overflow (Raúl Marín)
   - #4549, Fix schema qualification of internal types (Raúl Marín)
+  - #4546, Fix PLPGSQL functions missing the schema qualification (Raúl Marín)
 
 PostGIS 3.0.0rc1
 2019/10/08
index add7d1c10ad5ca80d842aedac92cfc0e938119c5..b3a22f032ed26d7e42e115b0ac1716dceb898bfd 100644 (file)
@@ -583,7 +583,7 @@ CREATE OR REPLACE FUNCTION ST_Length(geog geography, use_spheroid boolean DEFAUL
 -- Availability: 1.5.0 - this is just a hack to prevent unknown from causing ambiguous name because of geography
 CREATE OR REPLACE FUNCTION ST_Length(text)
        RETURNS float8 AS
-       $$ SELECT ST_Length($1::@extschema@.geometry);  $$
+       $$ SELECT @extschema@.ST_Length($1::@extschema@.geometry);  $$
        LANGUAGE 'sql' IMMUTABLE STRICT _PARALLEL;
 
 -- Availability: 2.0.0
index 26d82ee3087fb91a890872ab06d8a82024675a40..ac6cfd97706a772de1536caba426fe83488c42ac 100644 (file)
@@ -2049,7 +2049,7 @@ BEGIN
         IF upper(gc_old.type) = 'GEOMETRY' THEN
         -- This is an unconstrained geometry we need to do something
         -- We need to figure out what to set the type by inspecting the data
-            EXECUTE 'SELECT @extschema@.ST_srid(' || quote_ident(gcs.attname) || ') As srid, GeometryType(' || quote_ident(gcs.attname) || ') As type, @extschema@.ST_NDims(' || quote_ident(gcs.attname) || ') As dims ' ||
+            EXECUTE 'SELECT @extschema@.ST_srid(' || quote_ident(gcs.attname) || ') As srid, @extschema@.GeometryType(' || quote_ident(gcs.attname) || ') As type, @extschema@.ST_NDims(' || quote_ident(gcs.attname) || ') As dims ' ||
                      ' FROM ONLY ' || quote_ident(gcs.nspname) || '.' || quote_ident(gcs.relname) ||
                      ' WHERE ' || quote_ident(gcs.attname) || ' IS NOT NULL LIMIT 1;'
                 INTO gc;
@@ -5220,7 +5220,7 @@ CREATE OR REPLACE FUNCTION ST_GeomCollFromText(text, int4)
        RETURNS geometry
        AS '
        SELECT CASE
-       WHEN geometrytype(@extschema@.ST_GeomFromText($1, $2)) = ''GEOMETRYCOLLECTION''
+       WHEN @extschema@.geometrytype(@extschema@.ST_GeomFromText($1, $2)) = ''GEOMETRYCOLLECTION''
        THEN @extschema@.ST_GeomFromText($1,$2)
        ELSE NULL END
        '
@@ -5558,8 +5558,8 @@ AS $$
 DECLARE
        geomtext alias for $1;
        srid alias for $2;
-       mline geometry;
-       geom geometry;
+       mline @extschema@.geometry;
+       geom @extschema@.geometry;
 BEGIN
        mline := @extschema@.ST_MultiLineStringFromText(geomtext, srid);
 
@@ -5570,7 +5570,7 @@ BEGIN
 
        geom := @extschema@.ST_BuildArea(mline);
 
-       IF GeometryType(geom) != 'POLYGON'
+       IF @extschema@.GeometryType(geom) != 'POLYGON'
        THEN
                RAISE EXCEPTION 'Input returns more then a single polygon, try using BdMPolyFromText instead';
        END IF;
@@ -5600,8 +5600,8 @@ AS $$
 DECLARE
        geomtext alias for $1;
        srid alias for $2;
-       mline geometry;
-       geom geometry;
+       mline @extschema@.geometry;
+       geom @extschema@.geometry;
 BEGIN
        mline := @extschema@.ST_MultiLineStringFromText(geomtext, srid);
 
@@ -6001,14 +6001,14 @@ CREATE OR REPLACE FUNCTION _st_concavehull(param_inputgeom geometry)
   RETURNS geometry AS
 $$
        DECLARE
-       vexhull GEOMETRY;
-       var_resultgeom geometry;
-       var_inputgeom geometry;
-       vexring GEOMETRY;
-       cavering GEOMETRY;
-       cavept geometry[];
+       vexhull @extschema@.geometry;
+       var_resultgeom @extschema@.geometry;
+       var_inputgeom @extschema@.geometry;
+       vexring @extschema@.geometry;
+       cavering @extschema@.geometry;
+       cavept @extschema@.geometry[];
        seglength double precision;
-       var_tempgeom geometry;
+       var_tempgeom @extschema@.geometry;
        scale_factor float := 1;
        i integer;
        BEGIN
@@ -6065,7 +6065,7 @@ $$
                -- make sure result covers original (#3638)
                -- Using ST_UnaryUnion since SFCGAL doesn't replace with its own implementation
                -- and SFCGAL one chokes for some reason
-               var_resultgeom := @extschema@.ST_UnaryUnion(ST_Collect(param_inputgeom, var_resultgeom) );
+               var_resultgeom := @extschema@.ST_UnaryUnion(@extschema@.ST_Collect(param_inputgeom, var_resultgeom) );
                RETURN var_resultgeom;
 
        END;
@@ -6077,18 +6077,18 @@ LANGUAGE 'plpgsql' IMMUTABLE STRICT _PARALLEL _COST_HIGH;
 CREATE OR REPLACE FUNCTION ST_ConcaveHull(param_geom geometry, param_pctconvex float, param_allow_holes boolean DEFAULT false) RETURNS geometry AS
 $$
        DECLARE
-               var_convhull geometry := @extschema@.ST_ForceSFS(@extschema@.ST_ConvexHull(param_geom));
-               var_param_geom geometry := @extschema@.ST_ForceSFS(param_geom);
+               var_convhull @extschema@.geometry := @extschema@.ST_ForceSFS(@extschema@.ST_ConvexHull(param_geom));
+               var_param_geom @extschema@.geometry := @extschema@.ST_ForceSFS(param_geom);
                var_initarea float := @extschema@.ST_Area(var_convhull);
                var_newarea float := var_initarea;
                var_div integer := 6; /** this is the 1/var_div is the percent increase we will allow per geometry to keep speed decent **/
-               var_tempgeom geometry;
-               var_tempgeom2 geometry;
-               var_cent geometry;
-               var_geoms geometry[4]; /** We will cut the current geometry into 4 triangular quadrants along the centroid/extent **/
-               var_enline geometry;
-               var_resultgeom geometry;
-               var_atempgeoms geometry[];
+               var_tempgeom @extschema@.geometry;
+               var_tempgeom2 @extschema@.geometry;
+               var_cent @extschema@.geometry;
+               var_geoms @extschema@.geometry[4]; /** We will cut the current geometry into 4 triangular quadrants along the centroid/extent **/
+               var_enline @extschema@.geometry;
+               var_resultgeom @extschema@.geometry;
+               var_atempgeoms @extschema@.geometry[];
                var_buf float := 1; /** tolerance so that geometries that are right on the extent don't get accidentally clipped off **/
        BEGIN
                -- We start with convex hull as our base
index 484111d08524abc26222437157153964f72e9dfc..acb3ecfe6c9c37999be4bf4d2048b7f1854f458c 100644 (file)
@@ -2093,7 +2093,7 @@ CREATE OR REPLACE FUNCTION st_asjpeg(rast raster, options text[] DEFAULT NULL)
        RETURNS bytea
        AS $$
        DECLARE
-               rast2 raster;
+               rast2 @extschema@.raster;
                num_bands int;
                i int;
        BEGIN
@@ -2171,7 +2171,7 @@ CREATE OR REPLACE FUNCTION st_aspng(rast raster, options text[] DEFAULT NULL)
        RETURNS bytea
        AS $$
        DECLARE
-               rast2 raster;
+               rast2 @extschema@.raster;
                num_bands int;
                i int;
                pt text;
@@ -2385,7 +2385,7 @@ CREATE OR REPLACE FUNCTION st_asraster(
        RETURNS raster
        AS $$
        DECLARE
-               g geometry;
+               g @extschema@.geometry;
                g_srid integer;
 
                ul_x double precision;
@@ -3900,14 +3900,14 @@ CREATE OR REPLACE FUNCTION st_slope(
        RETURNS raster
        AS $$
        DECLARE
-               _rast raster;
+               _rast @extschema@.raster;
                _nband integer;
                _pixtype text;
                _pixwidth double precision;
                _pixheight double precision;
                _width integer;
                _height integer;
-               _customextent raster;
+               _customextent @extschema@.raster;
                _extenttype text;
        BEGIN
                _customextent := customextent;
@@ -3957,7 +3957,7 @@ CREATE OR REPLACE FUNCTION st_slope(
        scale double precision DEFAULT 1.0,     interpolate_nodata boolean DEFAULT FALSE
 )
        RETURNS raster
-       AS $$ SELECT @extschema@.ST_slope($1, $2, NULL::raster, $3, $4, $5, $6) $$
+       AS $$ SELECT @extschema@.ST_slope($1, $2, NULL::@extschema@.raster, $3, $4, $5, $6) $$
        LANGUAGE 'sql' IMMUTABLE _PARALLEL;
 
 -----------------------------------------------------------------------
@@ -4083,12 +4083,12 @@ CREATE OR REPLACE FUNCTION st_aspect(
        RETURNS raster
        AS $$
        DECLARE
-               _rast raster;
+               _rast @extschema@.raster;
                _nband integer;
                _pixtype text;
                _width integer;
                _height integer;
-               _customextent raster;
+               _customextent @extschema@.raster;
                _extenttype text;
        BEGIN
                _customextent := customextent;
@@ -4135,7 +4135,7 @@ CREATE OR REPLACE FUNCTION st_aspect(
        interpolate_nodata boolean DEFAULT FALSE
 )
        RETURNS raster
-       AS $$ SELECT @extschema@.ST_aspect($1, $2, NULL::raster, $3, $4, $5) $$
+       AS $$ SELECT @extschema@.ST_aspect($1, $2, NULL::@extschema@.raster, $3, $4, $5) $$
        LANGUAGE 'sql' IMMUTABLE _PARALLEL;
 
 -----------------------------------------------------------------------
@@ -4289,14 +4289,14 @@ CREATE OR REPLACE FUNCTION st_hillshade(
        RETURNS RASTER
        AS $$
        DECLARE
-               _rast raster;
+               _rast @extschema@.raster;
                _nband integer;
                _pixtype text;
                _pixwidth double precision;
                _pixheight double precision;
                _width integer;
                _height integer;
-               _customextent raster;
+               _customextent @extschema@.raster;
                _extenttype text;
        BEGIN
                _customextent := customextent;
@@ -4349,7 +4349,7 @@ CREATE OR REPLACE FUNCTION st_hillshade(
        interpolate_nodata boolean DEFAULT FALSE
 )
        RETURNS RASTER
-       AS $$ SELECT @extschema@.ST_hillshade($1, $2, NULL::raster, $3, $4, $5, $6, $7, $8) $$
+       AS $$ SELECT @extschema@.ST_hillshade($1, $2, NULL::@extschema@.raster, $3, $4, $5, $6, $7, $8) $$
        LANGUAGE 'sql' IMMUTABLE _PARALLEL;
 
 -----------------------------------------------------------------------
@@ -4449,14 +4449,14 @@ CREATE OR REPLACE FUNCTION st_tpi(
        RETURNS raster
        AS $$
        DECLARE
-               _rast raster;
+               _rast @extschema@.raster;
                _nband integer;
                _pixtype text;
                _pixwidth double precision;
                _pixheight double precision;
                _width integer;
                _height integer;
-               _customextent raster;
+               _customextent @extschema@.raster;
                _extenttype text;
        BEGIN
                _customextent := customextent;
@@ -4501,7 +4501,7 @@ CREATE OR REPLACE FUNCTION st_tpi(
        pixeltype text DEFAULT '32BF', interpolate_nodata boolean DEFAULT FALSE
 )
        RETURNS RASTER
-       AS $$ SELECT @extschema@.ST_tpi($1, $2, NULL::raster, $3, $4) $$
+       AS $$ SELECT @extschema@.ST_tpi($1, $2, NULL::@extschema@.raster, $3, $4) $$
        LANGUAGE 'sql' IMMUTABLE _PARALLEL;
 
 -----------------------------------------------------------------------
@@ -4585,14 +4585,14 @@ CREATE OR REPLACE FUNCTION st_roughness(
        RETURNS raster
        AS $$
        DECLARE
-               _rast raster;
+               _rast @extschema@.raster;
                _nband integer;
                _pixtype text;
                _pixwidth double precision;
                _pixheight double precision;
                _width integer;
                _height integer;
-               _customextent raster;
+               _customextent @extschema@.raster;
                _extenttype text;
        BEGIN
                _customextent := customextent;
@@ -4632,7 +4632,7 @@ CREATE OR REPLACE FUNCTION ST_roughness(
        pixeltype text DEFAULT '32BF', interpolate_nodata boolean DEFAULT FALSE
 )
        RETURNS RASTER
-       AS $$ SELECT @extschema@.ST_roughness($1, $2, NULL::raster, $3, $4) $$
+       AS $$ SELECT @extschema@.ST_roughness($1, $2, NULL::@extschema@.raster, $3, $4) $$
        LANGUAGE 'sql' IMMUTABLE _PARALLEL;
 
 -----------------------------------------------------------------------
@@ -4731,14 +4731,14 @@ CREATE OR REPLACE FUNCTION st_tri(
        RETURNS raster
        AS $$
        DECLARE
-               _rast raster;
+               _rast @extschema@.raster;
                _nband integer;
                _pixtype text;
                _pixwidth double precision;
                _pixheight double precision;
                _width integer;
                _height integer;
-               _customextent raster;
+               _customextent @extschema@.raster;
                _extenttype text;
        BEGIN
                _customextent := customextent;
@@ -4783,7 +4783,7 @@ CREATE OR REPLACE FUNCTION st_tri(
        pixeltype text DEFAULT '32BF', interpolate_nodata boolean DEFAULT FALSE
 )
        RETURNS RASTER
-       AS $$ SELECT @extschema@.ST_tri($1, $2, NULL::raster, $3, $4) $$
+       AS $$ SELECT @extschema@.ST_tri($1, $2, NULL::@extschema@.raster, $3, $4) $$
        LANGUAGE 'sql' IMMUTABLE _PARALLEL;
 
 -----------------------------------------------------------------------
@@ -4843,7 +4843,7 @@ CREATE OR REPLACE FUNCTION st_grayscale(
 
                nrast integer;
                idx integer;
-               rast raster;
+               rast @extschema@.raster;
                nband integer;
 
                stats summarystats;
@@ -5232,7 +5232,7 @@ CREATE OR REPLACE FUNCTION st_setgeoreference(rast raster, georef text, format t
     $$
     DECLARE
         params text[];
-        rastout raster;
+        rastout @extschema@.raster;
     BEGIN
         IF rast IS NULL THEN
             RAISE WARNING 'Cannot set georeferencing on a null raster in st_setgeoreference.';
@@ -6738,7 +6738,7 @@ CREATE OR REPLACE FUNCTION ST_Intersection(
        RETURNS raster
        AS $$
        DECLARE
-               rtn raster;
+               rtn @extschema@.raster;
                _returnband text;
                newnodata1 float8;
                newnodata2 float8;
@@ -7691,8 +7691,8 @@ CREATE OR REPLACE FUNCTION _add_raster_constraint_coverage_tile(rastschema name,
                _tileheight integer;
                _alignment boolean;
 
-               _covextent geometry;
-               _covrast raster;
+               _covextent @extschema@.geometry;
+               _covrast @extschema@.raster;
        BEGIN
                fqtn := '';
                IF length($1) > 0 THEN
@@ -8992,7 +8992,7 @@ CREATE OR REPLACE FUNCTION _UpdateRasterSRID(
                sql := 'UPDATE ' || fqtn ||
                        ' SET ' || quote_ident($3) ||
                        ' =  @extschema@.ST_SetSRID(' || quote_ident($3) ||
-                       '::raster, ' || srid || ')';
+                       '::@extschema@.raster, ' || srid || ')';
                RAISE NOTICE 'sql = %', sql;
                EXECUTE sql;
 
@@ -9044,7 +9044,7 @@ DECLARE
   ipy FLOAT8;
   tx int;
   ty int;
-  te GEOMETRY; -- tile extent
+  te @extschema@.GEOMETRY; -- tile extent
   ncols int;
   nlins int;
   srid int;
@@ -9173,7 +9173,7 @@ CREATE OR REPLACE FUNCTION st_makeemptycoverage(tilewidth int, tileheight int, w
         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@.raster;       -- an empty template raster, where each cell
                                -- represents a tile in the coverage
         minY double precision;
         maxX double precision;