Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2016
    Posts
    18
    Provided Answers: 1

    Answered: pg_restor wrong text format dump

    Hi all,
    Running in linux bash command I got format error:
    Code:
    _SQL$ pg_restore -i -h localhost -U postgres -d upload_test -v  "/_wwwroot/wprods/__SQL/outfile.sql"
    pg_restore: [archiver] input file appears to be a text format dump. Please use psql.
    But outfile.sql file is valid sql file with header:
    Code:
    --
    -- PostgreSQL database dump
    --
    
    SET statement_timeout = 0;
    SET lock_timeout = 0;
    SET client_encoding = 'UTF8';
    SET standard_conforming_strings = on;
    SET check_function_bodies = false;
    SET client_min_messages = warning;
    
    --
    -- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: 
    --
    which was created by using command

    Code:
    pg_dump  -h localhost  -U postgres -W  wprods > /_wwwroot/wprods/__SQL/outfile.sql
    What is the problem and hpow to fix it ?

    postgresql version : 9.4.10

    Thanks!

  2. Best Answer
    Posted by mstdmstd

    "Thank you!
    For me right command was
    Code:
    psql -h localhost  -d upload_test -U  postgres  -W -f "/_wwwroot/wprods/__SQL/outfile.sql"
    "


  3. #2
    Join Date
    Nov 2003
    Posts
    2,988
    Provided Answers: 23
    You created a plain text dump which is just a SQL script. You "import" that by running the script through psql.

    Please see the manual for details: https://www.postgresql.org/docs/curr...ckup-dump.html
    I will not read nor answer questions where the SQL code is messy and not formatted properly using [code] tags: http://www.dbforums.com/misc.php?do=bbcode#code

    Tips for good questions:

    http://tkyte.blogspot.de/2005/06/how...questions.html
    http://wiki.postgresql.org/wiki/SlowQueryQuestions
    http://catb.org/esr/faqs/smart-questions.html

  4. #3
    Join Date
    Oct 2016
    Posts
    18
    Provided Answers: 1
    I saw this article.
    1) I added "-F p" key in in pg_dump command :

    Code:
    pg_dump  -h localhost  -U postgres -W -F p  wprods > /_wwwroot/wprods/__SQL/outfile.sql
    2) I logged into psql and under it run command
    Code:
    upload_test < "/_wwwroot/wprods/__SQL/outfile.sql"
    but nothing happanned...

    Which is the right command ?

  5. #4
    Join Date
    Nov 2003
    Posts
    2,988
    Provided Answers: 23
    Quote Originally Posted by mstdmstd View Post
    Which is the right command ?
    psql as I wrote and as is documented in the manual:
    Code:
    psql -f "/_wwwroot/wprods/__SQL/outfile.sql"
    https://www.postgresql.org/docs/curr...ckup-dump.html
    I will not read nor answer questions where the SQL code is messy and not formatted properly using [code] tags: http://www.dbforums.com/misc.php?do=bbcode#code

    Tips for good questions:

    http://tkyte.blogspot.de/2005/06/how...questions.html
    http://wiki.postgresql.org/wiki/SlowQueryQuestions
    http://catb.org/esr/faqs/smart-questions.html

  6. #5
    Join Date
    Oct 2016
    Posts
    18
    Provided Answers: 1
    Thank you!
    For me right command was
    Code:
    psql -h localhost  -d upload_test -U  postgres  -W -f "/_wwwroot/wprods/__SQL/outfile.sql"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •