Skip to content

Instantly share code, notes, and snippets.

@jczaplew
Created September 17, 2015 22:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jczaplew/a04230573a09c7d68013 to your computer and use it in GitHub Desktop.
Save jczaplew/a04230573a09c7d68013 to your computer and use it in GitHub Desktop.
pg_dump raster error
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
@jczaplew
Copy link
Author

The following error will be thrown:

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

@jczaplew
Copy link
Author

Can be fixed by changing SET search_path = rasters, pg_catalog; to SET search_path = public, rasters, pg_catalog; in the dump file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment