If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > PostgreSQL > File corrupt Postgresql v9

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-02-11, 06:05
flashed flashed is offline
Registered User
 
Join Date: Mar 2011
Posts: 6
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?
Reply With Quote
  #2 (permalink)  
Old 03-15-11, 16:25
rski rski is offline
Registered User
 
Join Date: Nov 2006
Posts: 82
What kind of backup did you make?
Do you store files in database, in what format?
Reply With Quote
  #3 (permalink)  
Old 03-17-11, 11:42
flashed flashed is offline
Registered User
 
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
Reply With Quote
  #4 (permalink)  
Old 03-17-11, 14:55
rski rski is offline
Registered User
 
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.
Reply With Quote
  #5 (permalink)  
Old 03-18-11, 11:46
flashed flashed is offline
Registered User
 
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
Reply With Quote
  #6 (permalink)  
Old 03-18-11, 12:04
shammat shammat is offline
Registered User
 
Join Date: Nov 2003
Posts: 2,408
How exactly did you restore the backup?
Please copy & paste the commands (including the error message) from the commandline
Reply With Quote
  #7 (permalink)  
Old 03-18-11, 12:33
flashed flashed is offline
Registered User
 
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!
Reply With Quote
  #8 (permalink)  
Old 03-18-11, 12:36
shammat shammat is offline
Registered User
 
Join Date: Nov 2003
Posts: 2,408
"none of these works" is not a valid error message.

What where the exact commands you execute to take the backup?
Reply With Quote
  #9 (permalink)  
Old 03-18-11, 15:21
rski rski is offline
Registered User
 
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?
Reply With Quote
  #10 (permalink)  
Old 03-22-11, 16:07
flashed flashed is offline
Registered User
 
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!!!
Reply With Quote
  #11 (permalink)  
Old 03-22-11, 16:16
shammat shammat is offline
Registered User
 
Join Date: Nov 2003
Posts: 2,408
So did you get an error message or not?
Reply With Quote
  #12 (permalink)  
Old 03-25-11, 07:06
flashed flashed is offline
Registered User
 
Join Date: Mar 2011
Posts: 6
Re

No, when i restore (all the ways) didn't give me any error.
Reply With Quote
  #13 (permalink)  
Old 03-25-11, 07:20
shammat shammat is offline
Registered User
 
Join Date: Nov 2003
Posts: 2,408
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On