1

Im trying to restore an sql file which contains the dumpf a table (with COPY commands) into a table into the database, it would be great if someone could share an example, as the pg_restore doesn't help much in this regard. A link would do as well.

Further information: Through the psql command line client I tried to first access the database and then execute the method presented by @a_horse _with_no_name; but nothing seemed to happen, it just went on to show the next prompt; but there was no change in the backend(data was not inserted into the database). I may be doing something grossly wrong here, just got started with PostgreSQL. :)

migrated from stackoverflow.com Feb 1 '12 at 14:08

This question came from our site for professional and enthusiast programmers.

  • What kind of *dumpf" ? is it readable? – wildplasser Feb 1 '12 at 12:01
  • @a_horse_with_no_name- A step by step of what I did. 1.Windows command line prompt 2. Changed to the bin folder of Postgresql. 3. placed the dump (sql file) in the bin folder. 4.Executed psql dbname<dumpfile.sql. Would be great if you could tell me what Im doing wrong, Thanks! – seeker Feb 3 '12 at 4:13
1

If your dump file contains COPY statements, then it's a SQL dump which is restored using psql as explained in the manual.

psql dbname < your_dump_file.sql

More examples are in the manual.

  • tried that!(Nothing happened) In this case my dump file just contains one table, so should a new table be created then? – KodeSeeker Feb 1 '12 at 12:13
  • You should have included that information (that you already tried psql) into your original question. I don't believe that "nothing happened" - please edit your question to include the exact statements you used (e.g. copy & paste the text from the console) – a_horse_with_no_name Feb 1 '12 at 12:14

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.