1

I have a backup of an unlogged table called potential_users, the relation has 58677237 records in it.

Steps:

pg_dump --format custom --verbose --file "potential_users.backup" --table "public.potential_users" productiondb

pg_restore -a -t potential_users potential_users.backup

I see the data prompted in the terminal and when it finishes shows:

PostgreSQL database dump complete

But after a SELECT count(*) FROM potential_users; 0 is returned.

Colin 't Hart
  • 9,455
  • 15
  • 36
  • 44
Imanol Y.
  • 785
  • 2
  • 10
  • 28

2 Answers2

-1

Not really a solution but a workaround that worked is to restore through a csv file.

COPY potential_users FROM '/potential_users.csv' WITH (FORMAT csv);
Imanol Y.
  • 785
  • 2
  • 10
  • 28
-1

Don't you need to tall pg_restore which database to populate?

pg_restore -a -t potential_users potential_users.backup   -d OTHER_DATABASE

From the Docs:

If a database name is specified, pg_restore connects to that database and restores archive contents directly into the database. Otherwise, a script containing the SQL commands necessary to rebuild the database is created and written to a file or standard output.

It sounds like you're seeing the latter, with the data (SQL script) appearing in the window.

Phill W.
  • 9,889
  • 1
  • 12
  • 24