id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc 2485,[raster]: raster constraints prevent raster data from restoring,rdunklau,Bborie Park,"The sql functions installed by PostGIS should probably set their own search path, or qualify the underlying function calls namespace. Take the following function definition from raster/rt_pg/rtpostgis.sql.in: {{{ CREATE OR REPLACE FUNCTION _raster_constraint_pixel_types(rast raster) RETURNS text[] AS $$ SELECT array_agg(pixeltype)::text[] FROM st_bandmetadata($1, ARRAY[]::int[]); $$ LANGUAGE 'sql' STABLE STRICT; }}} The call to st_bandmetadata is not qualified. Therefore, when using this function in a constraint definition in another schema than public (let's say ns1), the table data can not be dumped and restored, since pg_restore sets the search_path to ns1, pg_catalog. This skips entirely the schema in which the st_bandmetadata resides (public, by default). This has another implication: this means that those function calls should probably be qualified by the @extschema@ namespace, which makes the extension non-relocatable. Please find attached a simple test case. How to reproduce: - create a database - run the supplied script against this database - use pg_dump to create a dump of the given database - use pg_restore to restore this dump What is expected: - the dump is restored successfully What happens: - the data from the ns1.t1 table is not restored, due to search_path issues when calling the check constraint function. ",defect,closed,critical,PostGIS 2.2.2,raster,2.1.x,fixed,,