You probably don't need any flags beyond specifying the target database
name. Follow Regina instructions: create a target database and add postgis
and postgis_raster extensions to it. The run pg_restore like:
     pg_restore   -d  target_database_name   your_pg_dump_file.backup
Postgres error messages are usually pretty clear so if that doesn't work it
will probably tell you why.

Rich


On Wed, Feb 11, 2026 at 9:41 AM David Haynes <[email protected]> wrote:

> Thanks for the help. Can you provide me with the flags I should use on
> PG_Restore.
>
> On Tue, Feb 10, 2026 at 5:48 AM Regina Obe <[email protected]> wrote:
>
>> Not sure what you mean by unintentionally dumped as binary format.  That
>> is the preferred way.
>>
>>
>>
>> What you should do is the following:
>>
>>
>>
>> Create a blank database.
>>
>>
>>
>> Run
>>
>>
>>
>> CREATE EXTENSION postgis;
>>
>> CREATE EXTENSION postgis_raster;
>>
>>
>>
>> Then restore your database into the new one you created.
>>
>>
>>
>> The only thing that should happen assuming you have an individual backup
>> for your database, is that it will failing when doing CREATE EXTENSION
>> postgis;  which is fine and expected.
>>
>>
>>
>> But your raster data will find the datatype and functions it needs in
>> postgis_raster so should do fine.
>>
>>
>>
>> *From:* David Haynes <[email protected]>
>> *Sent:* Tuesday, February 10, 2026 1:28 AM
>> *To:* [email protected]
>> *Subject:* PG_Restore error
>>
>>
>>
>> Hello,
>>
>>
>>
>> I have an old PostgreSQL database dump file that uses the old PostGIS
>> extension. What I mean is that the database was created when the extension
>> used to be CREATE Extension PostGIS. Now there are at least 2 commands:
>> CREATE Extension postgis and  CREATE Extension postgis_raster; This
>> particular database has both vector and raster datasets. To complicate
>> matters, I unintentionally dumped it in a binary format.
>>
>> I have been somewhat successful in getting the DB to load. I'm using a
>> pg_restore command using the following flags (--no-owner --create --clean).
>> However, I get a lot of errors because the database can not create raster
>> datasets as that datatype does not exist. Is there a command that I can
>> issue during this pg_restore process to initialize the postgis_raster
>> extension? If not, what are my next steps? Do I need to load the database
>> onto an older version of PostGIS?
>>
>>
>>
>> Thanks for any feedback
>>
>

-- 
Richard W. Greenwood

Reply via email to