Re: DDL for database creation

From: Ron <ronljohnsonjr(at)gmail(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: DDL for database creation
Date: 2019-03-09 04:01:05
Message-ID: 7b2aee26-5cd4-ea9b-0862-3f2bdf9029f7@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 3/8/19 9:20 PM, Tom Lane wrote:
> Bruce Momjian <bruce(at)momjian(dot)us> writes:
>> On Sat, Mar 9, 2019 at 02:13:57AM +0000, Julie Nishimura wrote:
>>> Is there a way to reconstruct DDL for creation of existing databases? For
>>> example, I need to create dev environment for some (not all) of our existing
>>> databases, and I would like to keep the same encoding, connection limit (if
>>> anything was specified), etc. Is there a way to create this DDL?
>> pg_dump --schema-only maybe?
> The specific settings the OP mentions are database-level settings;
> so she'd need pg_dumpall (perhaps with -g), or pg_dump with -C.

Why not "pg_dumpall --schema-only" in combination with "pg_dumpall -g"?

https://www.postgresql.org/docs/9.6/app-pg-dumpall.html
-s
--schema-only
    Dump only the object definitions (schema), not data.

--
Angular momentum makes the world go 'round.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andreas Kretschmer 2019-03-09 08:23:00 Re: Postgres 10 temp tablespace question
Previous Message Tom Lane 2019-03-09 03:20:12 Re: DDL for database creation