phpPgAdmin can restore a PostgreSQL database from a plain-text SQL dump through its web interface, typically via the "SQL" window or, on some builds, an "Import" tab on an existing database. The key condition is that the file must be a SQL script the database can execute in order, because phpPgAdmin has no built-in handling for binary custom-format dumps made with pg_dump -Fc. If you have a .dump or .backup file, you need pg_restore from the command line instead. Everything below assumes a .sql file, a working phpPgAdmin login with sufficient privileges, and a target database that you've already created or that you intend to create during the restore.
The tool itself is a mature, browser-based administration front end for PostgreSQL, written in PHP. It has been a standard part of shared-hosting control panels for years, which is exactly why people reach for it when a database needs to come back from a backup and no SSH access is available. This guide covers the full sequence: what to prepare, how to avoid the most common failure modes, how to run the restore in each of the interface layouts you're likely to meet, and how to verify that the data actually landed.
What phpPgAdmin can and cannot restore
phpPgAdmin is a thin client. It sends SQL text to the PostgreSQL server over a connection and displays whatever comes back. That architecture shapes what it can do.
It handles:
Plain-text SQL dumps, whether produced by pg_dump without a format flag, by the older pg_dumpall, or by phpPgAdmin's own "Export" feature. Individual table exports, including the per-table downloads phpPgAdmin produces. Pasted SQL text, if the script is small enough to fit in the SQL window and your PHP configuration allows it. Scripts that create objects, insert rows, and set permissions, all in one pass.
It cannot handle:
Custom-format archives from pg_dump -Fc, which are binary and require pg_restore. Directory-format dumps from pg_dump -Fd. Tar-format dumps. Anything larger than the web server's request-size and execution-time limits, without configuration changes outside phpPgAdmin. Restores that need pg_restore options such as selective object loading, parallel restore, or --clean ordering that the server must orchestrate.
That last limitation matters more than it sounds. A plain SQL dump is often written with DROP TABLE statements and COPY blocks. If the target database already contains those tables, the restore either fails on the CREATE or silently destroys existing data depending on how the dump was generated. You control that, so check the file before you upload it.
Prerequisites before you touch the interface
The restore will go more smoothly if you've settled four things first.
A SQL dump file. Open the file in a text editor and look at the first few dozen lines. You want to see CREATE TABLE, ALTER TABLE, INSERT, or COPY statements. If the file begins with a binary header such as PGDMP, it's a custom-format archive and phpPgAdmin can't read it. If it's gzip-compressed (.sql.gz or .gz), decompress it first, because phpPgAdmin's import path expects the raw script in most builds. A quick check of the file size is also worthwhile: a 500 MB script will almost certainly time out in a browser session without PHP and web-server tuning.
A login with the right privileges. The PostgreSQL role you sign in with needs CREATE on the target database and, for dumps that include ownership and grants, membership in the roles named in the dump or superuser status. A dump taken as the postgres superuser will contain ALTER TABLE ... OWNER TO postgres lines. If you're restoring as a lesser role, those statements fail unless the role exists and you can set ownership. You can strip them out of the file ahead of time, or restore as a role that can perform them.
A target database. Two strategies exist. You can create an empty database in phpPgAdmin first (the "Create database" form on the server or database list page) and restore into it, or you can let the dump create the database itself if it begins with CREATE DATABASE. Most people do the former, because it keeps the dump's assumptions contained. Either way, confirm the target uses the same encoding as the dump, typically UTF8; a mismatch can corrupt non-ASCII text silently.
Awareness of your server's limits. The PHP directive upload_max_filesize, post_max_size, and max_execution_time, plus the web server's own limits and any proxy in front of it, decide how large a file you can actually get through the browser. On shared hosting these are frequently 2 to 64 MB for uploads. If your dump is bigger, ask your host about raising them, or switch to psql on the command line if you have shell access. This is the single most common reason a restore "just doesn't work" through phpPgAdmin.
Step-by-step: restoring through the SQL window
The SQL window is the path that exists on every phpPgAdmin version, so start here if you're unsure which layout you have.
1: Log in and select the target database. After signing in, click the database name in the left-hand tree or the database list on the server page. The right pane should show the database's schemas, tables, and other objects. If you land on the server page instead, choose the database from the dropdown or the list.
2: Open the SQL window. Look for the "SQL" link in the horizontal menu, usually alongside "Schemas," "Tables," and "Export." A text area appears for typing or pasting a query.
3: Choose the file to upload. In most builds, the SQL window includes a file-upload field below or beside the text area, often labeled "Upload" or "Choose file." Select your .sql file. Some versions offer an "Import" tab on the database page instead, with a browse button; if you see that, use it and skip to the execution step. The behavior is equivalent.
4: Decide on the "character set" and "encoding" settings. If the form offers an encoding selector, match it to the dump's encoding, normally UTF8. Choosing the wrong one causes garbled text rather than an outright error, which is worse because it's easy to miss.
5: Submit and watch the result. Click "Execute" or "Go." phpPgAdmin sends the entire script to PostgreSQL and displays the server's response for each statement, usually in a table of query results or a scrollable message log. A successful run ends with messages confirming table creation and row counts from COPY or INSERT statements.
6: Read failures rather than restarting blindly. If the output contains a red error, note the exact line. The most common ones are relation "x" already exists (the target wasn't empty, or the dump includes CREATE for objects you already have), permission denied for schema public (insufficient privileges), and syntax errors near a particular statement (often a version incompatibility, covered below). Fix the cause and rerun against a clean database rather than rerunning over a half-restored one.
A simple success check: after the script finishes, click "Tables" in the menu and confirm the expected tables are listed, then click one and browse its rows to confirm content. That's faster and more reliable than trusting the message log alone.
Restoring in the Import tab layout
Some phpPgAdmin builds, especially those packaged with hosting panels, present a dedicated import form instead of routing everything through the SQL window. The flow is shorter.
Select the target database, click "Import," browse to the .sql file, optionally set the encoding, and submit. The interface typically offers a radio choice between "SQL" and "CSV" input, and for a normal dump you want "SQL." If a "Format" dropdown lists plain, custom, tar, or directory, choose plain—phpPgAdmin will reject the others anyway because the server-side restore tool it would need isn't invoked from the browser.
If both the SQL window and an import tab exist in your build, they accomplish the same thing. Use whichever is present; there's no need to do both.
Loading a dump into an existing, non-empty database
This is where most real restores get messy, because people often want to merge a backup into a database that already has tables. phpPgAdmin won't decide that for you.
Three approaches work:
Restore into a fresh database and rename. Create a new database, restore the dump there, verify it, then either point your application at the new database or rename the old one aside and the new one into place. This keeps the original data intact until you're satisfied, which is the safest sequence.
Add --clean-style statements to the dump. If you generated the dump yourself, produce it with pg_dump --clean --if-exists so the script drops objects before recreating them. Then restoring into a populated database overwrites cleanly. If you only have the dump file, you can hand-edit DROP TABLE lines into it, but that's error-prone at scale and worth doing only for small scripts.
Restore only specific tables. phpPgAdmin's export feature writes per-table SQL files. If you only need three tables back, export or keep individual files and restore them one at a time through the SQL window, which also keeps each request small.
Note that COPY blocks in a dump append rows rather than replacing them if the table already exists and the dump doesn't drop it first. That produces duplicate-key errors or silent duplicates depending on constraints, so a fresh target is the clean answer.
When the dump came from a different PostgreSQL version
SQL dumps are mostly portable, but not entirely. Statements that exist in newer servers—identity columns introduced around PostgreSQL 10, GENERATED ALWAYS AS ... STORED columns, newer ALTER TABLE syntax—will fail on older ones. The reverse also happens: dumps from old versions may use syntax that newer servers parse differently, though this is rarer because PostgreSQL maintains strong backward compatibility.
phpPgAdmin doesn't translate between versions; it forwards text. So check the dump's origin version, visible in its header comments if it came from pg_dump (-- Dumped from database version 15.4 and similar lines), and compare it with the server you're restoring to, shown on phpPgAdmin's server page. If they differ by several major versions and the restore fails on syntax, the practical fix is to restore with a matching-version psql or pg_restore outside phpPgAdmin, or to regenerate the dump from the source using the target's pg_dump version.
Troubleshooting: symptoms, likely causes, and the checks to run first
The upload appears to succeed but nothing is restored. The script may have failed on its first statement, and the message log is below the fold. Scroll the results pane. If there are no results at all, the file may not have been sent—check post_max_size against the file size.
You get a white page or a timeout. The script is too large for the PHP execution limit, or a statement inside it runs longer than allowed. Confirm the file size and your host's max_execution_time; splitting the dump into chunks by table is the reversible first fix.
"Permission denied for schema public." In PostgreSQL 15 and later, ordinary roles lost the implicit CREATE grant on the public schema that older versions provided. The dump's CREATE TABLE public.x statements therefore fail for a non-owner role. Grant CREATE on the schema to your restore role, or restore as the database owner. This is a version-specific change worth checking before assuming the dump is corrupt.
"Role ... does not exist." The dump contains ALTER ... OWNER TO or GRANT statements for roles that don't exist in the target cluster. Either create those roles first, restore as a user permitted to set ownership, or strip the ownership and grant lines from the file before uploading. The third option is fastest for a one-off recovery but leaves objects owned by the restoring role.
Text with accents or non-Latin characters comes back as mojibake. The encoding selector didn't match the dump. Recreate the database with the correct encoding and rerun; converting after the fact is a separate operation and not something phpPgAdmin does for you.
Partial restore with an error midway. PostgreSQL runs each statement in its own transaction unless the script explicitly wraps them, and pg_dump output doesn't wrap everything in one. So a failure leaves earlier objects in place. Drop and recreate the target database, then rerun from the top rather than trying to resume.
The stop condition: if you've confirmed the file is a plain SQL dump, the sizes and limits are within bounds, permissions are correct, and errors persist on statements you can't interpret—especially errors mentioning internal catalog state, encoding conversion, or server version incompatibilities—stop editing the dump and take it to your hosting provider's database support or a PostgreSQL administrator. Hand-patching a production dump is how small problems become unrecoverable ones.
Verifying the restore actually worked
Don't stop at a clean-looking message log. Three checks, in increasing depth, confirm the job.
First, count objects. In phpPgAdmin, the database page summarizes tables, views, sequences, and functions. Compare those counts with what you know the source had; a missing sequence or function is easy to overlook and breaks applications that depend on auto-increment behavior or stored procedures.
Second, spot-check rows. Open two or three of the most important tables and browse a page of rows. Confirm the row count shown at the bottom of the browse view is plausible against the source. phpPgAdmin can run SELECT COUNT(*) from the SQL window against each table if you want an exact figure.
Third, exercise the application. The strongest verification is the one that matters: point the application at the restored database and run its normal read paths. A restore that passes both checks above but fails at the application layer usually means ownership or grant statements didn't apply, and the app's role lacks privileges on the new objects.
Keeping restores reliable over time
phpPgAdmin's "Export" feature can produce the plain SQL dumps it can later restore, so a workable routine is to keep exports in that format rather than relying on pg_dump -Fc archives you can't load through the browser. Store dumps off-server, note the PostgreSQL version and encoding at the top of a small companion file, and rehearse the restore into a scratch database once, so you know which limit or permission trips you before you're recovering under pressure. Once you've done it, the procedure is short; the preparation is what takes the time.