1

first question here, fairly new to DB's and Data itself.

My question is fairly simple, after playing around with Postgres, PGAdmin3, I realised I would like to access some public data, but I struggled to find any publicly available .tar files to practice with. Leading me to wonder what file formats you can restore from.

What file formats can I restore from using pg_restore? And is there a preference in the community towards certain formats?

Thanks for your time. Look forward to participating on the forum.

PS: If it wasn't clear, I am restoring from command line.

  • The purpose of pg_restore is to restore the formats that pg_dump produces. See the -F option of pg_dump – Daniel Vérité Jul 4 '17 at 9:15
1

Exactly one file format is supported by pg_restore: the custom PostgreSQL dump formats from pg_dump -F c (custom), -F d (directory) and -F t (tar). Notably it cannot restore -F s (SQL) format dumps, which must be passed to psql -f instead.

If you want to load data, you probably want the \copy command from psql or the server-backend COPY command. It can load a variety of CSV-like data.

There are also external loader and ETL tools that can do more, e.g. pgloader, Talend Studio, Pentaho Kettle, CloverETL, etc.

  • 1
    According to the help, pg_restore can also handle -F d ("directory format") and -F t ("tar format") – a_horse_with_no_name Jul 4 '17 at 5:29
  • @a_horse_with_no_name Oops, fixed – Craig Ringer Jul 4 '17 at 6:05

Your Answer

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