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.

0

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);
  • 1
    This could be added to your question. – McNets Mar 12 '18 at 16:25
0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.