0

I am using PostgreSQL 12.2, and I have some *.sql files to import into a database

pg_restore -U postgres -d iotmaster -f D:\iotmaster.sql

But I am facing this Error

pg_restore: error: options -d/--dbname and -f/--file cannot be used together

How to import .sql file in my database?

Ram kumar
  • 19
  • 3
  • 9
  • A SQL script is applied using `psql`, e.g. `psql -U your_user -d your_db -f iotmaster.sql` –  Apr 02 '20 at 08:21
  • I try that but it shows `The input is a PostgreSQL custom-format dump. Use the pg_restore command-line client to restore this dump to a database.` – Ram kumar Apr 02 '20 at 08:35
  • 1
    Well, [as documented in the manual](https://www.postgresql.org/docs/current/app-pgrestore.html) the input file for `pg_restore` is **not** specified with `-f`, so you need to use `pg_restore -U postgres -d iotmaster iotmaster.sql` (but choosing `.sql` as the extension for a custom dump was a really bad idea) –  Apr 02 '20 at 08:40
  • thanks it's work for me – Ram kumar Apr 02 '20 at 13:45

0 Answers0