pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: David Gauthier <davegauthierpg@gmail.com>
To: pgsql-general@postgresql.org
Subject: Re: Need create table statements from metadata
Date: Thu, 20 Jun 2019 14:59:45 -0700
Message-ID: <c8032f45-fb3f-3df8-7d68-59a0dea173ce@aklaver.com> (raw)
In-Reply-To: <CAMBRECDGoMqTwpqG8xRyGc0rc0UpefMUCod4pw8he5umQDiwgg@mail.gmail.com>
References: <CAMBRECDGoMqTwpqG8xRyGc0rc0UpefMUCod4pw8he5umQDiwgg@mail.gmail.com>

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





view thread (3+ messages)  latest in thread

Message-ID: <c8032f45-fb3f-3df8-7d68-59a0dea173ce@aklaver.com>
Permalink:  ../c8032f45-fb3f-3df8-7d68-59a0dea173ce@aklaver.com/
Also on:    postgresql.org/message-id/c8032f45-fb3f-3df8-7d68-59a0dea173ce@aklaver.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, davegauthierpg@gmail.com
  Subject: Re: Need create table statements from metadata
  In-Reply-To: <c8032f45-fb3f-3df8-7d68-59a0dea173ce@aklaver.com>
  References: <CAMBRECDGoMqTwpqG8xRyGc0rc0UpefMUCod4pw8he5umQDiwgg@mail.gmail.com> <c8032f45-fb3f-3df8-7d68-59a0dea173ce@aklaver.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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