Re: PG_Restore error

Richard Greenwood <[email protected]> Wed, 11 Feb 2026 13:01:08 -0700
Newsgroups gmane.comp.gis.postgis
Message-ID <CAHBySPbzoTZNWRgayaqDGDxhadjQ42F51dtMo5-w0nFac90qRA@mail.gmail.com>
--000000000000e2d44a064a91d59f
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

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=E2=80=AFAM David Haynes <[email protected]> w=
rote:

> 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=E2=80=AFAM 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 extensi=
on
>> 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 --clea=
n).
>> However, I get a lot of errors because the database can not create raste=
r
>> 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 databas=
e
>> onto an older version of PostGIS?
>>
>>
>>
>> Thanks for any feedback
>>
>

--=20
Richard W. Greenwood

--000000000000e2d44a064a91d59f
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">You probably don&#39;t need any flags beyond specifying th=
e target database name. Follow Regina instructions: create a target databas=
e and add postgis and postgis_raster extensions to it. The run pg_restore l=
ike:<div>=C2=A0 =C2=A0 =C2=A0pg_restore=C2=A0 =C2=A0-d=C2=A0 target_databas=
e_name=C2=A0 =C2=A0your_pg_dump_file.backup</div><div>Postgres error messag=
es are usually pretty clear so if that doesn&#39;t work it will probably te=
ll you why.</div><div><br></div><div>Rich</div><div><br></div></div><br><di=
v class=3D"gmail_quote gmail_quote_container"><div dir=3D"ltr" class=3D"gma=
il_attr">On Wed, Feb 11, 2026 at 9:41=E2=80=AFAM David Haynes &lt;<a href=
=3D"mailto:[email protected]">[email protected]</a>&gt; wrote:<br></div><=
blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-l=
eft:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr">Thanks fo=
r the help. Can you provide me with the flags I should use on PG_Restore.=
=C2=A0</div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_=
attr">On Tue, Feb 10, 2026 at 5:48=E2=80=AFAM Regina Obe &lt;<a href=3D"mai=
lto:[email protected]" target=3D"_blank">[email protected]</a>&gt; wrote:<br></div><blo=
ckquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left=
:1px solid rgb(204,204,204);padding-left:1ex"><div><div lang=3D"EN-US"><div=
><p class=3D"MsoNormal">Not sure what you mean by unintentionally dumped as=
 binary format.=C2=A0 That is the preferred way.<u></u><u></u></p><p class=
=3D"MsoNormal"><u></u>=C2=A0<u></u></p><p class=3D"MsoNormal">What you shou=
ld do is the following:<u></u><u></u></p><p class=3D"MsoNormal"><u></u>=C2=
=A0<u></u></p><p class=3D"MsoNormal">Create a blank database.<u></u><u></u>=
</p><p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p><p class=3D"MsoNormal">R=
un <u></u><u></u></p><p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p><p clas=
s=3D"MsoNormal">CREATE EXTENSION postgis;<u></u><u></u></p><p class=3D"MsoN=
ormal">CREATE EXTENSION postgis_raster;<u></u><u></u></p><p class=3D"MsoNor=
mal"><u></u>=C2=A0<u></u></p><p class=3D"MsoNormal">Then restore your datab=
ase into the new one you created.<u></u><u></u></p><p class=3D"MsoNormal"><=
u></u>=C2=A0<u></u></p><p class=3D"MsoNormal">The only thing that should ha=
ppen assuming you have an individual backup for your database, is that it w=
ill failing when doing CREATE EXTENSION postgis;=C2=A0 which is fine and ex=
pected.<u></u><u></u></p><p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p><p =
class=3D"MsoNormal">But your raster data will find the datatype and functio=
ns it needs in postgis_raster so should do fine.<u></u><u></u></p><p class=
=3D"MsoNormal"><u></u>=C2=A0<u></u></p><div style=3D"border-top:none;border=
-right:none;border-bottom:none;border-left:1.5pt solid blue;padding:0in 0in=
 0in 4pt"><div><div style=3D"border-right:none;border-bottom:none;border-le=
ft:none;border-top:1pt solid rgb(225,225,225);padding:3pt 0in 0in"><p class=
=3D"MsoNormal"><b><span style=3D"font-size:11pt;font-family:Calibri,sans-se=
rif">From:</span></b><span style=3D"font-size:11pt;font-family:Calibri,sans=
-serif"> David Haynes &lt;<a href=3D"mailto:[email protected]" target=3D"_=
blank">[email protected]</a>&gt; <br><b>Sent:</b> Tuesday, February 10, 20=
26 1:28 AM<br><b>To:</b> <a href=3D"mailto:[email protected]" t=
arget=3D"_blank">[email protected]</a><br><b>Subject:</b> PG_Re=
store error<u></u><u></u></span></p></div></div><p class=3D"MsoNormal"><u><=
/u>=C2=A0<u></u></p><div><p class=3D"MsoNormal">Hello,<u></u><u></u></p><di=
v><p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p></div><div><p class=3D"Mso=
Normal">I have an old PostgreSQL database dump file that uses the old PostG=
IS extension. What I mean is that the database was created when the extensi=
on used to be CREATE Extension PostGIS. Now there are at least 2 commands: =
CREATE Extension postgis and=C2=A0 CREATE Extension postgis_raster; This pa=
rticular database has both vector and raster datasets. To complicate matter=
s, I unintentionally dumped it in a binary format.=C2=A0<br><br>I have been=
 somewhat successful in getting the DB to load. I&#39;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 t=
his 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 versio=
n of PostGIS?<u></u><u></u></p></div><div><p class=3D"MsoNormal"><u></u>=C2=
=A0<u></u></p></div><div><p class=3D"MsoNormal">Thanks for any feedback<u><=
/u><u></u></p></div></div></div></div></div></div></blockquote></div>
</blockquote></div><div><br clear=3D"all"></div><div><br></div><span class=
=3D"gmail_signature_prefix">-- </span><br><div dir=3D"ltr" class=3D"gmail_s=
ignature"><div dir=3D"ltr">Richard W. Greenwood<br></div></div>

--000000000000e2d44a064a91d59f--