Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h2TAg-0001F8-Nh for pgsql-general@arkaria.postgresql.org; Sat, 09 Mar 2019 04:01:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h2TAe-0003Oe-6S for pgsql-general@arkaria.postgresql.org; Sat, 09 Mar 2019 04:01:12 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h2TAd-0003OW-OB for pgsql-general@lists.postgresql.org; Sat, 09 Mar 2019 04:01:11 +0000 Received: from mail-ot1-x341.google.com ([2607:f8b0:4864:20::341]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h2TAb-0005o2-1M for pgsql-general@lists.postgresql.org; Sat, 09 Mar 2019 04:01:10 +0000 Received: by mail-ot1-x341.google.com with SMTP id g1so19174531otj.11 for ; Fri, 08 Mar 2019 20:01:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=snajad9+kMLTXSx6KfltnikxiSSC/OQFg9GXTfYt42k=; b=JwErNSP3rEz8MIkovKnjX6n7oKE8T/3DkfU4RCUekdqVxbdclAEiPnnBrN9JARrhpN SiJxMGOWBZ+gUkkOsmRs3wkLzU4ELcKsi95YuLh3nW1/up8QuA+tV1qWOkAw0zMsKbc3 IRcQBj5FT6tRQVMMQN3+B/pTrHkrlLZcNm7G1HN/Wvw41ikrgGS44Vfzpfo4+iD9agh+ HcFi6UDCChXyJFz32pdyKP6z2Jpabhf69GHFG8BcL8jvBnGP4hutKub01qQF5kkamjbP hlXNZMiBq1+C7maxxilFjHY5UQEAns55yeff3uuJZZSx59n1OBS5SN8lV2nSDZBZ8xpu Xj5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=snajad9+kMLTXSx6KfltnikxiSSC/OQFg9GXTfYt42k=; b=UDCry4Z9q/UdA25oiUGhhqeNUMD7oY9H1zbo/tDnh7oN5s/LKZMctXVwg6CaZJ2/LF yHaJNt0zgs1qsKmmkaqCeZRBJyodxZHLqU3sha12S8OClXrwRG5vibSkCrr/POBQFFuE vOO1kh5nnZ3Hg1gu+5/I0oAps/2oeZ9UIjC3dGOrIYFk9v84Js44cuDJeCYky1nojM02 fpI+UOAiNxzgmGlR/+7yp0ADZBqXOLuUyrEUB3NCYuSZDwV7dAsm31RNVWYUxvUi3jfq WWXFkTEgnrn7voPowPJRVtvsR1/sUlvGl4+J+cU84Q94zolXy3gX9WpaYMVtC/nTlh9q fVRw== X-Gm-Message-State: APjAAAURiuq4lzPbRdL1E42g1CndUhL0DkGwaVMTptZZHDW8f05PnFDh 9toPQQ0UyUquUGUOSWsCZODtM1wa X-Google-Smtp-Source: APXvYqzlU17JEke+ipRpR/bwCtCsuouoj4iktgXYHAMc8R5tB6e1QbW9wGqkxEZ+Kvp8wMAp98R86A== X-Received: by 2002:a9d:27a5:: with SMTP id c34mr13965960otb.30.1552104067782; Fri, 08 Mar 2019 20:01:07 -0800 (PST) Received: from [192.168.1.10] (ip70-171-116-89.no.no.cox.net. [70.171.116.89]) by smtp.googlemail.com with ESMTPSA id n6sm3786322oif.12.2019.03.08.20.01.06 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Mar 2019 20:01:06 -0800 (PST) Subject: Re: DDL for database creation To: pgsql-general@lists.postgresql.org References: <20190309023929.2ps4qotfwhj2b4hw@momjian.us> <28977.1552101612@sss.pgh.pa.us> From: Ron Message-ID: <7b2aee26-5cd4-ea9b-0862-3f2bdf9029f7@gmail.com> Date: Fri, 8 Mar 2019 22:01:05 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <28977.1552101612@sss.pgh.pa.us> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 3/8/19 9:20 PM, Tom Lane wrote: > Bruce Momjian 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.