Results 1 to 13 of 13
  1. #1
    Join Date
    Mar 2011
    Posts
    6

    Unanswered: File corrupt Postgresql v9

    Hi all,


    I change Postgresql v8.4 to v9. Before that i bakup all databases. After Postgresql v9 installed i restore the backup. One of the database has a table that contains files(pdf, png, etc...).

    When i tryed to open this files, the windows give me a error "File corrupt".

    Can u help with this error, why the change of postgresql to version 9 corrupted the files?

  2. #2
    Join Date
    Nov 2006
    Posts
    82
    What kind of backup did you make?
    Do you store files in database, in what format?

  3. #3
    Join Date
    Mar 2011
    Posts
    6

    Re

    What kind of backup did you make?
    - The normaly backup through PgAmdin. (file.backup)
    - I already restore (the same backup used ond postgresql 9.0) on postgresql 8.4 and it works.
    - And i even try another backup.sql, but doesn't work either

    Do you store files in database, in what format?
    files: pdf, jpeg, png

    BD format: bytea

  4. #4
    Join Date
    Nov 2006
    Posts
    82
    I'm not sure what does pgadmin but see here
    PostgreSQL: Documentation: Manuals: PostgreSQL 9.0: Migration Between Releases
    maybe it will help you.

  5. #5
    Join Date
    Mar 2011
    Posts
    6

    Red face Re

    I read the documentation and i did that. I did 2 backups:
    - Onde with pgadmin(bundled with the postgres package installation) tool;
    - The other with pg_dump (command line) like says on potgresql documentation;

    I really don't know why it doesn't work

  6. #6
    Join Date
    Nov 2003
    Posts
    2,935
    Provided Answers: 12
    How exactly did you restore the backup?
    Please copy & paste the commands (including the error message) from the commandline

  7. #7
    Join Date
    Mar 2011
    Posts
    6

    re

    I tryed 3 ways:

    - Restore by pgAdmin
    - psql dbname postgres < e:\file.sql
    - pg_restore --host=localhost --dbname=dbname --username= postgres c:\file.backup

    none of these works!

  8. #8
    Join Date
    Nov 2003
    Posts
    2,935
    Provided Answers: 12
    "none of these works" is not a valid error message.

    What where the exact commands you execute to take the backup?

  9. #9
    Join Date
    Nov 2006
    Posts
    82
    Shammat I think that restore command did not return an error. As I understood the problem is with files which ate stored in database in bytea fileds, which are corrupted after restore.
    @flashed am I right? Is this your problem?

  10. #10
    Join Date
    Mar 2011
    Posts
    6

    re

    I tryed 3 ways:

    Attempt 1 - Restore by pgAdmin (application)
    Attempt 2 - Command(at command line, postgres bin directory) = psql dbname postgres < e:\file.sql
    Attempt 3 - Command(at command line, postgres bin directory) = pg_restore --host=localhost --dbname=dbname --username= postgres c:\file.backup

    Shammat what part of this post you didn't understood??? "
    "none of these works" is not a valid error message." - off course, was only one comment

    Yes rski you are right, is exactly that!!!

  11. #11
    Join Date
    Nov 2003
    Posts
    2,935
    Provided Answers: 12
    So did you get an error message or not?

  12. #12
    Join Date
    Mar 2011
    Posts
    6

    Re

    No, when i restore (all the ways) didn't give me any error.

  13. #13
    Join Date
    Nov 2003
    Posts
    2,935
    Provided Answers: 12
    You need to find out if the data in the database is wrong, or if your application has a problem.

    I would start with checking the length of the bytea column in the old and the new database:
    Code:
    SELECT length(your_bytea_column) 
    FROM your_table
    If those are identical, then chances are it's your application.

    In that case it might be an outdated driver you are using.

    In 9.0 the encoding for binary data has changed. If you are using an old driver, this will affect the way binary data is received in your application.

    http://www.postgresql.org/docs/9.0/static/release-9-0.html#AEN99329

Posting Permissions

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