pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
DDL for database creation
4+ messages / 4 participants
[nested] [flat]

* DDL for database creation
@ 2019-03-09 02:13 Julie Nishimura <juliezain@hotmail.com>
  2019-03-09 02:39 ` Re: DDL for database creation Bruce Momjian <bruce@momjian.us>
  0 siblings, 1 reply; 4+ messages in thread

From: Julie Nishimura @ 2019-03-09 02:13 UTC (permalink / raw)
  To: pgsql-general

Hello psql friends,
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?

Thank you!

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: DDL for database creation
  2019-03-09 02:13 DDL for database creation Julie Nishimura <juliezain@hotmail.com>
@ 2019-03-09 02:39 ` Bruce Momjian <bruce@momjian.us>
  2019-03-09 03:20   ` Re: DDL for database creation Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 4+ messages in thread

From: Bruce Momjian @ 2019-03-09 02:39 UTC (permalink / raw)
  To: Julie Nishimura <juliezain@hotmail.com>; +Cc: pgsql-general

On Sat, Mar  9, 2019 at 02:13:57AM +0000, Julie Nishimura wrote:
> Hello psql friends,
> 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?

-- 
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

+ As you are, so once was I.  As I am, so you will be. +
+                      Ancient Roman grave inscription +




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: DDL for database creation
  2019-03-09 02:13 DDL for database creation Julie Nishimura <juliezain@hotmail.com>
  2019-03-09 02:39 ` Re: DDL for database creation Bruce Momjian <bruce@momjian.us>
@ 2019-03-09 03:20   ` Tom Lane <tgl@sss.pgh.pa.us>
  2019-03-09 04:01     ` Re: DDL for database creation Ron <ronljohnsonjr@gmail.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Tom Lane @ 2019-03-09 03:20 UTC (permalink / raw)
  To: Bruce Momjian <bruce@momjian.us>; +Cc: Julie Nishimura <juliezain@hotmail.com>; pgsql-general

Bruce Momjian <bruce@momjian.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.

			regards, tom lane




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: DDL for database creation
  2019-03-09 02:13 DDL for database creation Julie Nishimura <juliezain@hotmail.com>
  2019-03-09 02:39 ` Re: DDL for database creation Bruce Momjian <bruce@momjian.us>
  2019-03-09 03:20   ` Re: DDL for database creation Tom Lane <tgl@sss.pgh.pa.us>
@ 2019-03-09 04:01     ` Ron <ronljohnsonjr@gmail.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Ron @ 2019-03-09 04:01 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

On 3/8/19 9:20 PM, Tom Lane wrote:
> Bruce Momjian <bruce@momjian.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.




^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2019-03-09 04:01 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-03-09 02:13 DDL for database creation Julie Nishimura <juliezain@hotmail.com>
2019-03-09 02:39 ` Bruce Momjian <bruce@momjian.us>
2019-03-09 03:20   ` Tom Lane <tgl@sss.pgh.pa.us>
2019-03-09 04:01     ` Ron <ronljohnsonjr@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox