Re: dumping only table definitions

From: Melvin Davidson <melvin6925(at)gmail(dot)com>
To: Kevin Brannen <KBrannen(at)efji(dot)com>
Cc: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: dumping only table definitions
Date: 2018-06-29 22:44:25
Message-ID: CANu8Fix-yj4iNoZwnbhfBZcWsYJkDRW7=dxRFfkdxr3Jer9uOA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Jun 29, 2018 at 6:30 PM, Kevin Brannen <KBrannen(at)efji(dot)com> wrote:

> I’m trying to figure out how to dump only the table definitions, well
> those and things they need directly, like sequences & types. What I do NOT
> want are all the millions (not literally but it feels like it J) of
> functions we have. Triggers would be all right if I must, as we only have a
> few of those.
>
>
>
> I’ve tried various combinations of args to pg_dump, with -s being what I’d
> like to work, but I still get all the functions.
>
>
>
> I suppose I could filter it with Perl or Awk, but that could be tricky. In
> fact, the best my searching could find is to do:
>
>
>
> pg_dump -s databasename | awk 'RS="";/CREATE TABLE[^;]*;/'
>
>
>
> which fails in some interesting ways.
>
>
>
> I could dump the schema (with functions) then load it into another DB then
> programmatically drop all the functions before dumping that with pg_dump,
> but again why should I have to.
>
>
>
> Is there any Pg tool that gives me just the table defs or am I going to
> have to write my own?
>
>
>
> Thanks,
>
> Kevin
> This e-mail transmission, and any documents, files or previous e-mail
> messages attached to it, may contain confidential information. If you are
> not the intended recipient, or a person responsible for delivering it to
> the intended recipient, you are hereby notified that any disclosure,
> distribution, review, copy or use of any of the information contained in or
> attached to this message is STRICTLY PROHIBITED. If you have received this
> transmission in error, please immediately notify us by reply e-mail, and
> destroy the original transmission and its attachments without reading them
> or saving them to disk. Thank you.
>

> What I do NOT want are all the millions (not literally but it feels like
it J) of functions we have.

It sounds like you would best be served by installing pg_extractor. In
essence, it is a super flexible version of pg_dump. You have your choice of
exactly what you want to dump.

https://github.com/omniti-labs/pg_extractor

--
*Melvin Davidson*
*Maj. Database & Exploration Specialist*
*Universe Exploration Command – UXC*
Employment by invitation only!

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Kevin Brannen 2018-06-29 22:56:10 RE: dumping only table definitions
Previous Message Tom Lane 2018-06-29 22:43:28 Re: dumping only table definitions