Re: How to import *.sql file to postgresql database

From: Andre Lopes <lopes80andre(at)gmail(dot)com>
To: Szymon Guz <mabewlun(at)gmail(dot)com>
Cc: postgresql Forums <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to import *.sql file to postgresql database
Date: 2010-07-18 20:24:14
Message-ID: AANLkTikEaO3vXV05ASD7noyb_sCBysfgI6-QFjgNJxIa@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)gmail(dot)com> wrote:

>
>
> 2010/7/18 Andre Lopes <lopes80andre(at)gmail(dot)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
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andre Lopes 2010-07-18 21:04:42 Re: How to import *.sql file to postgresql database
Previous Message Tom Lane 2010-07-18 20:16:09 Re: Full Text Search ideas