[PostGIS] #5790: Postgis-functions in Materialized views fail in Postgres 17 due to not fully qualified search path

PostGIS trac at osgeo.org
Fri Oct 4 03:27:21 PDT 2024


#5790: Postgis-functions in Materialized views fail in Postgres 17 due to not
fully qualified search path
---------------------+---------------------------
 Reporter:  maxbo    |      Owner:  pramsey
     Type:  defect   |     Status:  new
 Priority:  medium   |  Milestone:  PostGIS 3.4.4
Component:  postgis  |    Version:  3.4.x
 Keywords:           |
---------------------+---------------------------
 Since Postgres 17, While REFRESH MATERIALIZED VIEW is running, the
 search_path is temporarily changed to pg_catalog, pg_temp.

 Materialized Views, that use a directly some PostGIS-Functions fail, if
 these functions call other PostGIS-Functions without a full schema
 qualifier.

 For example:
 public.st_value(raster, integer, integer, boolean)

 calls

 st_value($1, 1::integer, $2, $3, $4)

 And if this is done during a "REFRESH MATERIALIZED VIEW",
 st_value(raster, integer, integer, integer, boolean)
 cannot be found.

 Another example:
 public.st_worldtorastercoordx(raster, geometry);
 refers to ST_x, ST_y, ST_SRID and ST_geometrytype
 which cannot be found during a "REFRESH MATERIALIZED VIEW".

 The issue could be fixed by changing the postgis-functions that call other
 postgis-functions by adding the schema:

 IF ( public.ST_geometrytype(pt) != 'ST_Point' ) THEN
                         RAISE EXCEPTION 'Attempting to compute raster
 coordinate with a non-point geometry';
                 END IF;
                 IF public.ST_SRID(rast) != public.ST_SRID(pt) THEN
                         RAISE EXCEPTION 'Raster and geometry do not have
 the same SRID';
                 END IF;
                 SELECT columnx INTO xr FROM
 public._ST_worldtorastercoord($1, public.ST_x(pt), public.ST_y(pt));
                 RETURN xr;
-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/5790>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-tickets mailing list