Just as the title says, I want to duplicate one table from a completely separate database in phpPgAdmin to another one. I have tried two ways but both did not work for me:
- Tried “Create table like” (database >> table >> create table like)
- this seems to can only duplicate a table within the database
- Tried export and import
- I tried to export the table I want, then heading over to the other database and try to import in an empty table. but the error i am getting is either “Import error: File could not be uploaded to the server phppgadmin” or “Import error: Failed to automatically determine the file format.”
Advertisement
Answer
you can use pg_dump
, which extract PostgreSQL database/table and the pipe it directly to another server/database
pg_dump -t table_name source_db | psql target_db
for more info read pg_dump documentation.