Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to export a PostgreSQL database from phpPgAdmin and for some reason it's dumping out an empty SQL file.

The database is definitely not empty.

To export it I am clicking on the database, then export, then selecting structure and data.

Any idea why this would be? Thanks

share|improve this question
2  
Can you export the same database using the same username from the command line? – Khaled Nov 19 '10 at 11:07
    
Logs would also be relevant here (Apache, and phppgAdmin logs if it uses them). It may be hitting an error in the export. – Andrew M. Nov 19 '10 at 13:05
    
I managed to export it from the command line, there must be some sort of error in my phpPgAdmin I think. Thanks! – Probocop Nov 19 '10 at 13:38
up vote 1 down vote accepted

I managed to export it from the command line using:

./pg_dump -U postgres -c -f /htdocs/databasename.sql databasename
share|improve this answer
3  
You may not want to dump your db into the webroot, even if you've obfuscated the name. – Dana the Sane Sep 12 '11 at 14:46

I had the same problem and checked my log:

/usr/lib/postgresql/8.4/bin/pg_dump: invalid option -- 'd'
Try "pg_dump --help" for more information.

phpPgAdmin uses the option -d, wich was deprecated in 2009, so I edited dbexport.php and replaced the "-d" with "--inserts", now it works just fine :D!

http://archives.postgresql.org/message-id/49B53447.30402@endpoint.com

share|improve this answer

In the export interface, choose export type "SQL" would return an empty file. Selecting "export type" as "COPY" is the right choice here - it return the dump sql file.

But I also think that phppgadmin sucks enough for us to use the command line instead. For example, it would fail but report no error if you upload an sql file exceeding the allowed upload file size (often ~ 2MB).

share|improve this answer

you need to modify your dbexport.php in /usr/share/phppgadmin (on Ubuntu)

modify line from passthru($cmd); to echo passthru($cmd); modify line $cmd = $exe . " -i"; to $cmd = $exe;

it will be enough. Cause parameter -i seems to be deprecated in postgres 9.5 , he gave error for me.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.