pg_dump is a utility for backing up a PostgreSQL database.
Questions tagged [pg-dump]
656 questions
32
votes
3 answers
pg_restore toc error
i was using the following syntax for pg_dump and restore
pg_dump eval --inserts -b -c --encoding UTF8 -Fc -f eval.sql.tar.gz -x -U postgres
createdb -T template0 test -U postgres
pg_restore -d test eval.sql.tar.gz -e -U postgres
the dump was…

MAHI
- 9,263
- 11
- 36
- 47
29
votes
4 answers
pg_restore with -C option does not create the database
I am using pg_dump and pg_restore for backup and restore of postgres database.
Here is some information from documentation that will be relevant for this question
For Pg_restore, -C option is described as follows
-C
--create
Create the database…

Swapnil17
- 666
- 1
- 10
- 22
29
votes
2 answers
Populate MySQL database from postgresql dump file
Actually I need to populate MySQL database from a SQL file which was generated by postgresql as
pg_dump dbname > myfile.sql
So, if I try to do like
mysql> source myfile.sql
This obviously does not work. Although it did populate 70% tables but I…

Nikhil Sharma
- 2,221
- 6
- 25
- 31
27
votes
2 answers
Getting "Access is denied" error when executing pg_dump on Windows
I'm trying to execute pg_dump for one of my PostgreSQL databases, but I am having permission problems.
C:\Windows\system32>pg_dump -U postgres -p 1863 -O social_sense > C:\\Program Files\\PostgreSQL\\8.4\\data\\social_sense.sql
I am getting the…

goh
- 27,631
- 28
- 89
- 151
26
votes
2 answers
Can I install pg_dump without installing postgres on Alpine?
I have tried to install pg_dump as part of installation of postgres-client, however it does not include pg_dump.
Can pg_dump be installed without a full installation of postgres on Alpine Linux?

Oleg
- 601
- 1
- 8
- 14
25
votes
4 answers
PostgreSQL - dump each table into a different file
I need to extract SQL files from multiple tables of a PostgreSQL database. This is what I've come up with so far:
pg_dump -t 'thr_*' -s dbName -U userName > /home/anik/psqlTest/db_dump.sql
However, as you see, all the tables that start with the…

QuestionEverything
- 4,809
- 7
- 42
- 61
24
votes
5 answers
postgresql pg_dump without schema name
pg_dump version 10.3 started adding the schema name explicitly to the table name. So what used to be
INSERT INTO table (id) VALUES (1);
Is now
INSERT INTO public.table (id) VALUES (1);
How can you switch it off? My problem is, that I dump this…

raumi75
- 341
- 1
- 2
- 4
22
votes
2 answers
Is there a way to get pg_dump to exclude a specific sequence?
I want to exclude a sequence from my pg_dump command which is putting the output into a plain file.
Command: /Library/PostgreSQL/8.4/bin/pg_dump --host localhost --port 5433 --username xxx --format plain --clean --inserts --verbose --file…

Graham
- 651
- 2
- 10
- 23
20
votes
1 answer
pg_dump ignoring table sequence?
I have been playing around with PostgreSQL lately, and am having trouble understanding how to backup and restore a single table.
I used pgadmin3 to backup a single table in my database, in order to copy it to a different server. When I try to do a…

demersus
- 1,185
- 2
- 10
- 24
19
votes
2 answers
Set sslmode=allow with pg_dump
I need to specify sslmode=allow when using psql to connect to my PostgreSQL DB, like: psql sslmode=allow -h localhost -p 5432
otherwise I get server does not support SSL, but SSL was required
I tried specifying the same option to pg_dump but it…

qwertzguy
- 15,699
- 9
- 63
- 66
18
votes
3 answers
Copying postgresql local to remote database (both with password) - ERROR: option "locale" not recognized
Working with Postgres 12 / Windows 10.
Trying to copy a remote database to localhost with the following command:
pg_dump -C -h remotehost -p 5432 -U postgres remotedb | psql -h localhost -p 5432 -U postgres localdb
CMD requests for password…

rodolfo_r
- 481
- 6
- 14
16
votes
2 answers
pg_dump --exclude-table pattern matching
The Problem
I use pg_dump to create a schema-only archive file of our database. I'd like to reduce the size of this file (and decrease the restore time) by omitting all but one of a set of partitioned tables in the dump.
For example, there are the…

EndlessLoop
- 316
- 3
- 11
15
votes
2 answers
Dumping a DB without pg_dump
Is there any way to dump a postgres db using psql only ( without pg_dump )?
Thanks.

pgpv
- 335
- 2
- 10
15
votes
1 answer
How to merge dump into database from PostgreSQL?
I'm working on the same databse schema on different machines (PostgreSQL). I would like to know, how to merge data from one machine to another. Schema has many tables (around 10). What I want to achieve?
Dump data from machine A to file…

Dariusz Mydlarz
- 2,940
- 6
- 31
- 59
14
votes
3 answers
how to update pg_dump to server version in Mac OS
I'm trying to backup a local database in my laptop (PostGresSQL 9.6 ,PgAdmin3) and I see the following error.
pg_dump: server version: 9.6.3; pg_dump version: 9.5.5
pg_dump: aborting because of server version mismatch
I've tried some answers on…

ASN
- 1,655
- 4
- 24
- 52