Обсуждение: How to use pg_restore with *.sql file?

Поиск
Список
Период
Сортировка

How to use pg_restore with *.sql file?

От
Andre Lopes
Дата:
Hi,

I have generate an *.sql file with the command:

[quote]
pg_dump -a --inserts databasename > exportfilename.sql
[/quote]

How can I use the pg_restore to import the data to the database?

I have tried:

[quote]
pg_restore -d databasename exportfilename.sql
[/quote]

But without success...

What is the best way to import the *.sql file to the database?


Best Regards,

Re: How to use pg_restore with *.sql file?

От
Scott Marlowe
Дата:
On Sat, Sep 25, 2010 at 6:19 AM, Andre Lopes <lopes80andre@gmail.com> wrote:
> Hi,
>
> I have generate an *.sql file with the command:
>
> [quote]
> pg_dump -a --inserts databasename > exportfilename.sql
> [/quote]
>
> How can I use the pg_restore to import the data to the database?

Don't.

Just use psql with plain sql dumps:

psql databasename -f exportfilename.sql

Re: How to use pg_restore with *.sql file?

От
Dmitriy Igrishin
Дата:
Hey Andre,

You should not use pg_restore with plain format dump. Use psql for it.

// Dmitriy.

Re: How to use pg_restore with *.sql file?

От
Andre Lopes
Дата:
Thanks a lot! It works.


On Sat, Sep 25, 2010 at 1:23 PM, Scott Marlowe <scott.marlowe@gmail.com> wrote:
On Sat, Sep 25, 2010 at 6:19 AM, Andre Lopes <lopes80andre@gmail.com> wrote:
> Hi,
>
> I have generate an *.sql file with the command:
>
> [quote]
> pg_dump -a --inserts databasename > exportfilename.sql
> [/quote]
>
> How can I use the pg_restore to import the data to the database?

Don't.

Just use psql with plain sql dumps:

psql databasename -f exportfilename.sql