My PowerShell current directory is the backup directory/folder.
I use pg_dump -h localhost -p 5432 -U postgres -d postgres -t emp > empbackup.sql to backup one specific table. I aslo use pg_dump -h localhost -p 5432 -U postgres -d postgres -t emp > empbackup.dump.
Now I want to restore this table to the database. emp table is no foreign key, primary key, totally isolated table.
I tried serval ways. All failed. related question: PostgreSQL - restoring one table from database dump
pg_restore -t emp -d postgres empbackup.sql
Error pg_restore: error: input file does not appear to be a valid archive
psql -U postgres -d postgres -f empbackup.sql
Error --psql:empbackup.sql:1: ERROR: syntax error at or near "ÿ_"
--LINE 1: ÿ_-
pg_restore --host localhost --port 5432 --username postgres -d postgres -t public.emp --verbose "C:\Users\JIAN HE\Desktop\pg\empbackup.sql"
Error --pg_restore: error: input file does not appear to be a valid archive
pg_restore -t emp -d postgresql empbackup.dump
Error pg_restore: error: input file does not appear to be a valid archive