What file formats can be restored using pg_restore on PostgreSQL?
-
08-10-2020 - |
質問
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.
解決
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.