[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgis-users
Subject:    Re: [postgis-users] postgis introduction data bundle can not restore a backup.
From:       Jian He <hejian.mark () gmail ! com>
Date:       2022-04-14 3:51:23
Message-ID: CAMV54g2YEzSRar-UsJjOEjg9Fn1g1v1cRDa1i=ZKpRVvBra2eQ () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Thanks.  Problem solved.

On Wed, Apr 13, 2022 at 5:51 PM Imre Samu <pella.samu@gmail.com> wrote:

> > 5. Loading spatial data — Introduction to PostGIS
> > ERROR:  type "public.geometry" does not exist
>
> as I see in the  "4. Creating a Spatial Database"
> https://postgis.net/workshops/postgis-intro/creating_db.html
> there are 2 important step
> - create Username as postgres.
> - "CREATE EXTENSION postgis;"
>
> and the restore should work.
> if you see an error like "ERROR:  duplicate key value violates unique
> constraint "nyc_census_blocks_pkey""
> you have to use "-c"  option
> "    -c, --clean                  clean (drop) database objects before
> recreating"
> add sometimes the "--verbose" option is also useful.
>
>
> regards,
>  Imre
>
>
>
>
> Jian He <hejian.mark@gmail.com> ezt írta (időpont: 2022. ápr. 13., Sze,
> 11:32):
>
>> 5. Loading spatial data — Introduction to PostGIS
>> <http://postgis.net/workshops/postgis-intro/loading_data.html>
>> Introduction to PostGIS — Introduction to PostGIS
>> <http://postgis.net/workshops/postgis-intro/index.html> (data bundle)
>>
>> I use the follow command to restore a database.
>>
>> *pg_restore -h localhost -p 5432 -U jian -d postgis_in_action
>> nyc_data.backup*
>>
>> I cannot load the backup file to database.
>> Too many errors like :
>>
>>  ERROR:  type "public.geometry" does not exist
>>  ERROR:  relation "public.nyc_census_blocks" does not exist
>>
>> There is only another .sql file. But the file only have one table:
>> *nyc_census_sociodata*
>>
>> where can I get the table create script.
>>
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users@lists.osgeo.org
>> https://lists.osgeo.org/mailman/listinfo/postgis-users
>>
> _______________________________________________
> postgis-users mailing list
> postgis-users@lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/postgis-users
>

[Attachment #5 (text/html)]

<div dir="ltr"><div><br></div><div>Thanks.   Problem solved.  </div></div><br><div \
class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Apr 13, 2022 at 5:51 PM \
Imre Samu &lt;<a href="mailto:pella.samu@gmail.com">pella.samu@gmail.com</a>&gt; \
wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">&gt; 5. \
Loading spatial data — Introduction to PostGIS<br><div>&gt; ERROR:   type \
&quot;public.geometry&quot; does not exist</div><div><br></div><div>as I see in the   \
&quot;4. Creating a Spatial Database&quot;   <a \
href="https://postgis.net/workshops/postgis-intro/creating_db.html" \
target="_blank">https://postgis.net/workshops/postgis-intro/creating_db.html</a>  \
</div><div>there are 2 important step</div><div>- create Username as postgres.     \
</div><div>- &quot;CREATE EXTENSION postgis;&quot;</div><div><br></div><div>and the  \
restore should work.</div><div>if you see an error like &quot;ERROR:   duplicate key \
value violates unique constraint \
&quot;nyc_census_blocks_pkey&quot;&quot;</div><div>you have to use &quot;-c&quot;   \
option</div><div><font face="monospace">&quot;      -c, --clean                       \
clean (drop) database objects before recreating&quot;</font><br></div><div>add \
sometimes the &quot;--verbose&quot; option is also useful.  \
</div><div><br></div><div><br></div><div>regards,</div><div>  \
Imre</div><div><br></div><div><br></div><div><br></div></div><br><div \
class="gmail_quote"><div dir="ltr" class="gmail_attr">Jian He &lt;<a \
href="mailto:hejian.mark@gmail.com" target="_blank">hejian.mark@gmail.com</a>&gt; ezt \
írta (időpont: 2022. ápr. 13., Sze, 11:32):<br></div><blockquote \
class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div \
dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><a \
href="http://postgis.net/workshops/postgis-intro/loading_data.html" \
target="_blank">5. Loading spatial data — Introduction to PostGIS</a><br></div><div \
dir="ltr"><a href="http://postgis.net/workshops/postgis-intro/index.html" \
target="_blank">Introduction to PostGIS — Introduction to PostGIS</a>  (data \
bundle)<br></div><div dir="ltr"><br></div><div>I use the follow command to restore a \
database.</div><div><br></div><div dir="ltr"><b>pg_restore -h localhost -p 5432 -U \
jian -d postgis_in_action nyc_data.backup</b></div><div dir="ltr"><br></div><div>I \
cannot load the backup file to database.</div><div>Too many errors like  \
:</div><div><br></div><div>  ERROR:   type &quot;public.geometry&quot; does not \
exist</div><div>  ERROR:   relation &quot;public.nyc_census_blocks&quot; does not \
exist<br></div><div><br>There is only another .sql file. But the file only  have  one \
table:<font color="#000000">  <span style="font-family:&quot;JetBrains \
Mono&quot;,monospace;font-size:9.8pt;background-color:rgb(255,255,255)"><b>nyc_census_sociodata</b></span></font><br></div><div><font \
color="#000000"><span style="font-family:&quot;JetBrains \
Mono&quot;,monospace;font-size:9.8pt;background-color:rgb(255,255,255)"><b><br></b></span></font></div><div><font \
color="#000000"><span style="font-family:&quot;JetBrains \
Mono&quot;,monospace;font-size:9.8pt;background-color:rgb(255,255,255)">where can I \
get the table create script.  \
</span></font></div><div><br></div></div></div></div></div></div></div> \
_______________________________________________<br> postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org" \
target="_blank">postgis-users@lists.osgeo.org</a><br> <a \
href="https://lists.osgeo.org/mailman/listinfo/postgis-users" rel="noreferrer" \
target="_blank">https://lists.osgeo.org/mailman/listinfo/postgis-users</a><br> \
</blockquote></div> _______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org" \
target="_blank">postgis-users@lists.osgeo.org</a><br> <a \
href="https://lists.osgeo.org/mailman/listinfo/postgis-users" rel="noreferrer" \
target="_blank">https://lists.osgeo.org/mailman/listinfo/postgis-users</a><br> \
</blockquote></div>



_______________________________________________
postgis-users mailing list
postgis-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/postgis-users


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic