Re: How to import *.sql file to postgresql database - Mailing list pgsql-general

From Andre Lopes
Subject Re: How to import *.sql file to postgresql database
Date
Msg-id AANLkTikEaO3vXV05ASD7noyb_sCBysfgI6-QFjgNJxIa@mail.gmail.com
Whole thread Raw
In response to Re: How to import *.sql file to postgresql database  (Szymon Guz <mabewlun@gmail.com>)
List pgsql-general
Thanks for the reply,

I have this error:

[quote]
ERROR:  invalid byte sequence for encoding "UTF8": 0xff
HINT:  This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by "client_encoding".
[/quote]

I have set the client encoding to LATIN1 like this,

[quote]
$psql <database>
database=> set client_encoding to "LATIN1";
SET
database=>\i /home/folder1/data.sql
[/quote]

Then I got this different error:

[quote]
psql:/home/folder1/data.sql:1: ERROR:  syntax error at or near "ÿþ"
LINE 1: ÿþ-
        ^
[/quote]

How should I solve this problem?


Best Regards,


On Sun, Jul 18, 2010 at 9:10 PM, Szymon Guz <mabewlun@gmail.com> wrote:


2010/7/18 Andre Lopes <lopes80andre@gmail.com>

Hi,

I have a DUMP file with INSERT's commands. I need to import this data to postgresql database with the "psql" command.

How can I do this task?

Best Regards,

Hi,
you can do that for example using the following command:

psql <database> < file.sql

where <datatabase> is the name of the database you use.

regards
Szymon Guz

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Full Text Search ideas
Next
From: Edoardo Panfili
Date:
Subject: Re: How to import *.sql file to postgresql database