Postgresql – Empty table after pg_restore

pg-restorepostgresqlpostgresql-10unlogged-tables

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.

Best Answer

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);