I'm new to PostgreSQL and PostGIS.

I'm adding a raster to a newly created PostGIS schema and table with the raster2pgsql command:

sudo raster2pgsql -I -C -s 3577 -t 50x60 /path/to/raster.tif schema.table | sudo -u user psql dbname 

Processing 1/1: ./sat/geotiff_clum_50m1218m/clum_50m1218m.tif
ERROR:  type "raster" does not exist
LINE 1: ...ata"."lulc_raster" ("rid" serial PRIMARY KEY,"rast" raster);

Found some helpful info about making sure that the PostGIS extension was enabled on my schema and can confirm that they are:

create extension postgis;
extension "postgis" already exists

create extension postgis_raster;
extension "postgis_raster" already exists

And that the raster type exists in the schema:

enter image description here

Using PostGIS 3.1 and PostgreSQL 13, on Ubuntu 20.04. I'm not sure what else to try.

2 Answers 2


For me the answer was: run create extension postgis_raster from a SQL client.

I had never used this extension, only vanilla postgis, but I was trying to install a PostGIS "add-on" that expected postgis_raster.


The issue was that the extensions postgis and postgis_raster were in the wrong schema: the extensions were in the postgis schema not my newly created schema. The other issue was that the search path was not pointing to the newly created schema.

#to see which schema an extension is installed into: 
\dx (from the psql prompt)

# to change the extension schema
ALTER EXTENSION ext_name SET SCHEMA myschema; 

#This changes the search path to the right schema
ALTER USER username SET search_path TO schemaname, "$user", public, postgis_schema;

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.