0

The following database restore command is failing because of too many command-line arguments (first is "151019_testbase.sql"). This is effected from a shell session within the directory of the application (I initially had it calling the backup file from a subdirectory _private/151019_testbase.sql but changing that does not alter the behaviour.

pg_restore -c -1 -v v4_development 151019_testbase.sql

The documentation has examples where multiple options are set pg_restore -C -d postgres db.dump, so that's not it (apparently). Note, this attempt is with option 1 (one) for running a single BEGIN/COMMIT

I do not see the source of the error.

I also attempted to issue the command running psql v4_development first (to also chef on previous state) and postgresql returns ERROR: syntax error at or near "pg_restore"

4
  • 1
    To run a .sql script you need to use psql. pg_restore is only needed to restore dumps taken in the "custom format" Oct 20, 2015 at 6:55
  • 1
    If your .sql file happens to be something that pg_restore can really consume (see @a_horse_with_no_name's comment), then try adding -d before the database name, like in your example. (I suppose v4_development is your database.)
    – dezso
    Oct 20, 2015 at 8:17
  • @deszo yes v4_development is the database. Yes the dump was obtained via custom format pg_dump -Fc. I am confused as to which shell I should be issuing the command, the bash shell or that after identifying with psql v4_development?
    – Jerome
    Oct 20, 2015 at 8:46
  • the -d option was the necessary element pg_restore -c -v -1 -d v4_development _private/151019_testbase.sql runs now
    – Jerome
    Oct 20, 2015 at 9:29

0

Your Answer

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

Browse other questions tagged or ask your own question.