Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have problem while i import database from backup I gives many output and many "invalid command" messages. In the end it gives an encoding error. what can the reason be?

my command: sudo -u postgres psql -U postgres -d modd -f database.sql

error:

ERROR: invalid byte sequence for encoding "UTF8": 0xe3 0x43 0xf1

psql:database.sql:6923400: invalid command \.
psql:database.sql:6923404: invalid command \.
psql:database.sql:6923426: invalid command \.
psql:database.sql:6923431: invalid command \.
Query buffer reset (cleared).
psql:database.sql:6923456: invalid command \n%checkoutdate%
psql:database.sql:6923461: ERROR:  syntax error at or near "emailtemplate_overdue_subject"
LINE 1: emailtemplate_overdue_subject Kutuphane materyallerinizin ia...
        ^
Query buffer reset (cleared).
psql:database.sql:6923462: invalid command \n%checkoutdate%
psql:database.sql:6923465: ERROR:  syntax error at or near "emailtemplate_reminder_subject"
LINE 1: emailtemplate_reminder_subject Materyal iade hatırlatma
        ^
Query buffer reset (cleared).
psql:database.sql:6923467: invalid command \n
.....
...
psql:database.sql:7913855: invalid command g��:`�
psql:database.sql:7913857: invalid command \�}>��p��{z�
psql:database.sql:7913858: invalid command \�[�P�j5)��xZ��N��YQ��M�Ю+$���6.1�d0)}W��eN6$��NP#N|bY�kηI)R!��%�媄RCY�ѽÌ�����'}ӭ�;!D�wh�_���b�L0J�0�қ�
psql:database.sql:8357490: ERROR:  invalid byte sequence for encoding "UTF8": 0xe3 0x43 0xf1

my file is more than 1 gb. there is some errors when I open with more.

more database.sql enter image description here

share|improve this question
    
Try again with psql -v ON_ERROR_STOP=1 -f my_dump.sql to see the first error. – Craig Ringer May 24 at 3:24
    
psql:Desktop/database.sql:2: ERROR: syntax error at or near "toc" LINE 1: toc.dat AS '$libdir/tsearch2', 'gtsvector_in' ^ – Ahmet Melih Başbuğ May 24 at 6:02
    
what is the dump format ? it seems that it's not plain sql. – Soni Harriz May 24 at 6:17
    
file Desktop/database.sql Desktop/database.sql: tar archive It was database.sql.gz I extracted. but when i use "file", output is this. – Ahmet Melih Başbuğ May 24 at 6:34
1  
it seems that it is custom format. You can try pg_restore. It will be helpful to know the exact command of the pg_dump. – Soni Harriz May 24 at 6:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.