Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8496109
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T23:45:38+00:00 2026-06-10T23:45:38+00:00

My intention is to dump a database using: pg_dump -U postgres -h localhost -p

  • 0

My intention is to dump a database using:

pg_dump -U postgres -h localhost -p 5432 MYDB | gzip > database_dump.gz

And to restore it onto another environment with:

gunzip -c database_dump.gz | ssh 10.10.10.10 \
  psql -1 -U postgres -h localhost -p 5432 MYDB

Before I restore the database on the second environment, I’m going to drop the existing database to make way for the new dump (containing newer data).

Here’s my question: Do I need to specify the -C parameter in my pg_dump statement so that the outputted dump file contains a CREATE DATABASE statement? I noticed that without the parameter, the dump file does not contain the CREATE DATABASE statement.

According to the 9.1 docs for the -C parameter, “This option is only meaningful for the plain-text format. For the archive formats, you can specify the option when you call pg_restore.” I’m not positive what that means. As you can see above, I’m restoring using psql and not pg_restore.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T23:45:40+00:00Added an answer on June 10, 2026 at 11:45 pm

    It means that using psql for recreating your database, you need to add -C.

    pg_restore is a tool specifically for restoring databases from scripts generated by pg_dump in non-plaintext format. You can’t use it interactively like psql. On the other hand, you have options for listing the objects in the archive and selecting which ones need to be restored. Another useful option is setting the number of concurrent jobs for processing the archive. In certain cases this can speed up restoring very much.

    If you don’t specify the output format for pg_dump using the -F option, it will create a plaintext archive for you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What are the pros and cons of using a dump-file as a basis of
My intention is to investigate the Methods of a Type using reflection in order
My intention is to transpose two files using multithreading. But the program below is
My intention is to create a dynamic 3D array in C++ using pointers. MyType***
I have no intention of using My for anything in any of my projects.
I'm creating a caching system to take data from an SQLite database table using
I'm using DBLIB driver for connecting to a MS SQL server 2008 database from
My intention is to have 4 main Nav-bars at a site. If the user
The intention is to build a wrapper to provide a consistent method of calling
My intention is to read every elements in the 2nd column into a buffer[]

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.