public inbox for [email protected]
help / color / mirror / Atom feedRedo CREATE DATABASE
5+ messages / 5 participants
[nested] [flat]
* Redo CREATE DATABASE
@ 2025-11-17 09:59 COURTAULT Francois <[email protected]>
0 siblings, 3 replies; 5+ messages in thread
From: COURTAULT Francois @ 2025-11-17 09:59 UTC (permalink / raw)
To: pgsql-general
THALES GROUP LIMITED DISTRIBUTION to email recipients
Hello everyone,
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 ?
Best Regards.
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Redo CREATE DATABASE
@ 2025-11-17 10:16 Guillaume Lelarge <[email protected]>
parent: COURTAULT Francois <[email protected]>
2 siblings, 1 reply; 5+ messages in thread
From: Guillaume Lelarge @ 2025-11-17 10:16 UTC (permalink / raw)
To: [email protected]
Hi,
On 17/11/2025 10:59, COURTAULT Francois wrote:
> THALES GROUP LIMITED DISTRIBUTION to email recipients
>
>
> Hello everyone,
>
> 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 <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 ?
>
You can't retrieve the old options if they have been changed later. You
can find the current ones with text tools like pg_restore, pg_dumpall,
or graphical tools (such as pgAdmin).
Regards.
--
Guillaume Lelarge
Consultant
https://dalibo.com
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Redo CREATE DATABASE
@ 2025-11-17 12:40 Greg Sabino Mullane <[email protected]>
parent: Guillaume Lelarge <[email protected]>
0 siblings, 0 replies; 5+ messages in thread
From: Greg Sabino Mullane @ 2025-11-17 12:40 UTC (permalink / raw)
To: Guillaume Lelarge <[email protected]>; +Cc: [email protected]
If you had log_statement set to something other than 'none', the create
database statement will appear in your database logs.
If you don't have it set, today would be a great day to set it to 'ddl'.
https://www.postgresql.org/docs/17/runtime-config-logging.html#RUNTIME-CONFIG-LOGGING-WHAT
Cheers,
Greg
--
Crunchy Data - https://www.crunchydata.com
Enterprise Postgres Software Products & Tech Support
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Redo CREATE DATABASE
@ 2025-11-17 15:52 Adrian Klaver <[email protected]>
parent: COURTAULT Francois <[email protected]>
2 siblings, 0 replies; 5+ messages in thread
From: Adrian Klaver @ 2025-11-17 15:52 UTC (permalink / raw)
To: COURTAULT Francois <[email protected]>; pgsql-general
On 11/17/25 01:59, COURTAULT Francois wrote:
> THALES GROUP LIMITED DISTRIBUTION to email recipients
>
>
> Hello everyone,
>
> 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 <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 ?
Assuming the database is still in the cluster.
In psql have you tried:
\l+ <the_db_name>
Also
select * from pg_database where datname = <the_db_name>
They may not give you everything, but it will be a start.
>
> Best Regards.
>
>
--
Adrian Klaver
[email protected]
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Redo CREATE DATABASE
@ 2025-11-17 15:59 Laurenz Albe <[email protected]>
parent: COURTAULT Francois <[email protected]>
2 siblings, 0 replies; 5+ messages in thread
From: Laurenz Albe @ 2025-11-17 15:59 UTC (permalink / raw)
To: COURTAULT Francois <[email protected]>; 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
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2025-11-17 15:59 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-11-17 09:59 Redo CREATE DATABASE COURTAULT Francois <[email protected]>
2025-11-17 10:16 ` Guillaume Lelarge <[email protected]>
2025-11-17 12:40 ` Greg Sabino Mullane <[email protected]>
2025-11-17 15:52 ` Adrian Klaver <[email protected]>
2025-11-17 15:59 ` Laurenz Albe <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox