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 1he560-0005iP-1A for pgsql-general@arkaria.postgresql.org; Thu, 20 Jun 2019 21:59:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1he55y-0003WV-IJ for pgsql-general@arkaria.postgresql.org; Thu, 20 Jun 2019 21:59:50 +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 1he55y-0003Vr-5F for pgsql-general@lists.postgresql.org; Thu, 20 Jun 2019 21:59:50 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1he55v-000233-RC for pgsql-general@postgresql.org; Thu, 20 Jun 2019 21:59:49 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 2C8A922116; Thu, 20 Jun 2019 17:59:47 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Thu, 20 Jun 2019 17:59:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm3; bh=r fUp5W6NaBddZiYkVAQ/A2aThOAXRVO7+azG0dRiJ/4=; b=WjKwv5tYGTnxMn8Hq CxATxDTHOL51CB8YZLwQz/Vzpd+J7GUmn6Qss0SARuARHGZYPlXFOQd+696wtcIo JdnBflZ0tOf7JvLieN6Nrjtz3exr57kTxhh+AaU823FPT/B1x+zbsfjltqI5TXK3 LK8UZzMcGtgaffrpp/EicpuBxKzujmHNsdLGRWk+S6Qvhp/Pbir4ThgEWO5wC67X jZB520K7VxHPBVmK/n7iYW5M/Zo89KCnwtDmBwy//YOt6uf7hK8sSiLrASa65xl0 q9KSh/fZfRwCjxehclYJApn1/tI+h38Y+EmoTm+te3j2gUaBuDmRWtXWqT0/F/qh JIn1A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=rfUp5W6NaBddZiYkVAQ/A2aThOAXRVO7+azG0dRiJ /4=; b=eBHzIRohCa1McaXF5rY6lxSrgCbjgkJGk4rZGb2ogUOcwDBvwrrBWG0LI yVY+MnZv8T9zoXRyuCi9ChTasrwes2i2CwiGbZPzzVXoyQNF0aa/lg8AMTFhsPLg 437q7KD57J48O++f/6HR7XKbz03hKWF4fDLm8RE6G56aWoXkcFZUy/yfHLnAPdp3 8HNEjxWdcpfKLIGabdj9YZ6SUU085TivgP5OsdhBCfgXZynbzUl6liGgf2QTi+7r 30MNUwxFygyGoXF4xN96C3mpS/byeB+MDUDVQzenZHpflr0O9XPLdznxeihFXBEp CQudQW8KvRbW9BAyOgnxvfAudc4sw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrtdehgddtfecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepuffvfhfhkffffgggjggtgfesthekre dttdefjeenucfhrhhomheptegurhhirghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhl rghvvghrsegrkhhlrghvvghrrdgtohhmqeenucffohhmrghinhepphhoshhtghhrvghsqh hlrdhorhhgnecukfhppeejgedrleegrdejfedrvddvvdenucfrrghrrghmpehmrghilhhf rhhomheprggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomhenucevlhhush htvghrufhiiigvpedt X-ME-Proxy: Received: from ranger.suse (unknown [74.94.73.222]) by mail.messagingengine.com (Postfix) with ESMTPA id 7CAFA380076; Thu, 20 Jun 2019 17:59:46 -0400 (EDT) Subject: Re: Need create table statements from metadata To: David Gauthier , pgsql-general@postgresql.org References: From: Adrian Klaver Message-ID: Date: Thu, 20 Jun 2019 14:59:45 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 6/20/19 2:32 PM, David Gauthier wrote: > psql (9.6.7, server 9.5.2) on linux. > > I have 2 DBs, one for dev the other is live.  I want to recreate several > tables in the dev db using the same metadata found in the live db.  But > I'm too lazy to manually transcribe everything and that's prone to error > anyway. > > In the past, I would just run pg_dump and capture metadata only for > selected tables, then use that to (re)create that tables in the other > DB.  But where I am now, they don't give me the privs to run pg_dump. When you say metadata are you talking about the DDL for an object? Use FDW?: https://www.postgresql.org/docs/9.6/postgres-fdw.html > > So I was wondering if there's a way to do this quickly and cleanly > without pg_dump.  Perhaps a stored procedure that pg_dump uses (or > something like that) ? > > Thanks in Advance ! -- Adrian Klaver adrian.klaver@aklaver.com