I want to import data just for particular tables in Postgres. How can I do that?
I've tried the following command. Didnt worked though.
pg_dump -U postgres -a -d -t data_pptlconfig db_name > db_file
Assuming you mean "a dump" when you say a "postgres file":
If it's an SQL format dump, you'd have to extract the part you want with a text editor and run just that part. The dump is essentially an SQL "program" to re-create the database, so there's really no other way to selectively restore bits of it.
If it's a custom-format dump, you can use pg_restore with the -t flag.
Use file the-dump-file to find out which it is if you do not know. Or look at the file with a text editor - if the first five bytes are PGDMP it's a PostgreSQL custom format dump; otherwise it'll be an SQL format dump.
> db_filecan only write to the db_file, it cannot read from it.pg_restorewith the-tflag. Usefile the-dump-fileto find out which it is if you do not know.