[postgis-tickets] [PostGIS] #3277: Raster import fails from different schema with constraint

PostGIS trac at osgeo.org
Thu Sep 17 15:38:37 PDT 2015


#3277: Raster import fails from different schema with constraint
-------------------------+---------------------------
 Reporter:  jczaplewski  |      Owner:  dustymugs
     Type:  defect       |     Status:  new
 Priority:  medium       |  Milestone:  PostGIS 2.1.9
Component:  raster       |    Version:  2.1.x
 Keywords:  raster       |
-------------------------+---------------------------
 When a raster table is not in the schema `public` and has a
 `raster_constraint_pixel_types constraint`, the following error is thrown
 when importing from `pg_dump`:

 {{{
 ERROR:  function st_bandmetadata(public.raster, integer[]) does not exist
 LINE 1:  SELECT array_agg(pixeltype)::text[] FROM st_bandmetadata($1...
                                                   ^
 HINT:  No function matches the given name and argument types. You might
 need to add explicit type casts.
 QUERY:   SELECT array_agg(pixeltype)::text[] FROM st_bandmetadata($1,
 ARRAY[]::int[]);
 CONTEXT:  SQL function "_raster_constraint_pixel_types" during inlining
 }}}

 It seems that the issue is that postgres is unable to find the proper
 spatial functions, and indeed if you alter the line

 {{{
    SET search_path = rasters, pg_catalog;
 }}}

 to


 {{{
    SET search_path = public, rasters, pg_catalog;
 }}}

 the import of the dump works as expected. You can reproduce this error
 with the following example:

 {{{
 CREATE DATABASE test;
 CREATE EXTENSION postgis;
 CREATE SCHEMA rasters;

 CREATE TABLE rasters.my_rasters (
   id serial NOT NULL,
   rast raster,
   CONSTRAINT enforce_pixel_types_rast CHECK
 ((public._raster_constraint_pixel_types(rast) = '{16BSI}'::text[]))
 );

 INSERT INTO rasters.my_rasters (rast) (
         SELECT ST_AsRaster(
                 ST_GeomFromText(
                         'LINESTRING(-108 30, -87 43)'
                 , 4326),
                 150, 150, '16BSI'
         )
 );

 pg_dump -C test > ~/Downloads/test.sql && dropdb test && psql <
 ~/Downloads/test.sql

 }}}

 My system and version information is as follows:

 PostgreSQL 9.3.1 on x86_64-apple-darwin12.5.0, compiled by i686-apple-
 darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM
 build 2336.11.00), 64-bit

 POSTGIS="2.1.0 r11822" GEOS="3.3.8-CAPI-1.7.8" PROJ="Rel. 4.8.0, 6 March
 2012" GDAL="GDAL 1.10.0, released 2013/04/24" LIBXML="2.9.1"
 LIBJSON="UNKNOWN" TOPOLOGY RASTER

--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/3277>
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