I want to store an elevation raster in a postgis database. However a problem occurs. I use the following command:

raster2pgsql -I -C -e -Y -F -s 4326 -t auto dem.tif schemaname.filename | psql -U blabla -d blabla -h localhost -p 5432

As long as I put the raster in the public schema, the command works properly. But when I change the schema name to some other database schema I have created, the command just returns ERROR: schema "schemaname" does not exist.

Do I overlook something?

Edit: the full error looks like this:

ERROR: schema "schemaname" does not exist ERROR: schema "schemaname" does not exist invalid command \. ERROR: syntax error at or near "0100000100" LINE 1: 0100000100B5EDD83C22BEF33E0CC0E6158FFAF2BE5981483035A34FC08E... ^ ERROR: schema "schemaname" does not exist ERROR: The value provided for schema is invalid CONTEXT: PL/pgSQL function addrasterconstraints(name,name,name,boolean,boolean,boolean,boolean,boolean,boolean,boolean,boolean,boolean,boolean,boolean,boolean) line 53 at RETURN

  • This might be basic, but have you verified you are putting these into the same database as where you created the schemas? Also, have you checked permissions? Jun 9, 2016 at 19:39
  • I'm certain of both points. I already stored tables with vector data in the DB in all schemas, so it seems this is not a permission issue.
    – flebbelep
    Jun 10, 2016 at 8:20

1 Answer 1


What is the actual schema name? Can you paste the output of \dn+. And try to run raster2pgsql with -Y which will use COPY instead of INSERT. There is a raster2pgsql argument (-q) that wraps the identifiers with quotes too, it may be worth trying this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.