Search code examples
postgresqlpgadmin

Postgres restore, error in toc relation doesn't exist


I was prototyping a system in a notebook and its monitor broke. I was able to turn it on and make the backup of my database. Now I am trying to restore it but the error is pretty strange for me. I am trying for hours to solve the problem, I've tried to use PgAdmin 4, tried several options and nothing. I've tried to use the pg_restore.exe tool but its same thing. My last resource is to provide a github repo so you can check it out. The relations doesn't exist. I would love to check if I did something wrong while performing the backup (like not including the tables) but, how I said, my PC is broken. But I am pretty sure I include all I needed.

By the way, I created a table called automoveis on PgAdmin and tried to restore against it. That's the original name in my old computer.

github sql file of the restore


Solution

  • The automoveis.sql file that you shared is a data-only dump--it will not CREATE TABLEs for you. You will have to create your own tables before you can restore this file. If you have access to the old database, you could try doing pg_dump --schema-only <database_name> to get the CREATE TABLE statements