views:

165

answers:

1

I have a PostgreSQL backup made with PHPPgadmin using Export > Copy (instead Copy > SQL which is actually what I need).

File contains entries like this:

COPY tablename(id, field) FROM stdin;
...

How to convert this file to SQL format?

INSERT INTO tablename...

I want to use Pgadmin to to import this file using execute SQL command.

+2  A: 

You can't convert that to SQL format (at least not straightforwardly).

If you can't re export, then the simpler option is to bypass phpPgadmin, login in your server and run something like

cat [yourdump.sql]  | psql [your connections args]

If you don't have shell access to your server, you might try you upload the file (via SFTP or FTP) and load it thorugh phpPgAdmin with "COPY <table> FROM <path_to_file_on_server>". But if there are many tables, you must (I believe) split the file and do it one at a time.

http://phppgadmin.sourceforge.net/?page=faq

leonbloy