Re: Redo CREATE DATABASE

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: COURTAULT Francois <francois(dot)courtault(at)thalesgroup(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Redo CREATE DATABASE
Date: 2025-11-17 15:59:01
Message-ID: 16611bea8a93082783eff714b9eb43e34d1ea68f.camel@cybertec.at
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, 2025-11-17 at 09:59 +0000, COURTAULT Francois wrote:
> I am looking to an old document where we (I was not there at that time) setup a database.
> Unfortunately, I was not able to find the CREATE DATABASE instruction used. It is not in any of our docs☹
> At https://www.postgresql.org/docs/17/sql-createdatabase.html we can see that a lot of options are available.
>  
> Do you know  if it is possible to retrieve the options we have set when we created the database ?

What I recommend is a schema-only dump with the --create option:

pg_dump --schema-only --create dbname

You will find CREATE DATABASE and perhaps ALTER DATABASE statements near the top that you
can use to create a copy of the database. There will also be GRANT statements for the
database.

Yours,
Laurenz Albe

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Marc Millas 2025-11-17 17:25:14 postgres in swap space
Previous Message Adrian Klaver 2025-11-17 15:52:14 Re: Redo CREATE DATABASE