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

How to use pg_restore with *.sql file?

From
Andre Lopes
Date:
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?

From
Scott Marlowe
Date:
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?

From
Dmitriy Igrishin
Date:
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?

From
Andre Lopes
Date:
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