10

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

3
  • 2
    Can you export the same database using the same username from the command line?
    – Khaled
    Nov 19, 2010 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, 2010 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, 2010 at 13:38

4 Answers 4

8

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.

2
  • 1
    It turns out that the last release of PhpPgAdmin is from 2013. However, there is a repo github.com/phppgadmin/phppgadmin where it is still maintained (more or less) and the last commit in master branch already has this issue resolved - the way you described.
    – Forseti
    Mar 12, 2018 at 9:29
  • Good to hear if it is still mintained and resolved this small problem ! :) However i'm not using it now ( have my own , written in java )
    – Shadow
    Mar 13, 2018 at 15:51
1

I managed to export it from the command line using:

./pg_dump -U postgres -c -f /htdocs/databasename.sql databasename
1
  • 3
    You may not want to dump your db into the webroot, even if you've obfuscated the name. Sep 12, 2011 at 14:46
1

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/[email protected]

1
  • In my phpPgAdmin installation, I already had --inserts and not -d but still got an empty file. Nov 24, 2016 at 10:50
0

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).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .