DDL for a single schema

From: <btober(at)seaworthysys(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: DDL for a single schema
Date: 2003-11-07 13:23:56
Message-ID: 65205.216.238.112.88.1068211436.squirrel@$HOSTNAME
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Is there a way to get a dump of all the DDL and data associated with a
single schema within a database?

What I tried in attempting to hack this out was

\dt consume.*

and

\dv consume.*

to get a list of tables and views in the schema named "consume", then
sent those lists to a file "tables.txt". Followed that with something
like

for n in `cat tables.txt` do; pg_dump -t $n >> consume.sql; done

This almost worked, except for that I have some duplicate table names in
other schemas, and the pg_dump picked up both the table I wanted in the
consume schema and the the similarly-named table in a different schema.
I'd really like to be able to get the complete dump for one schema and no
more. Might work if you could specify a schema-qualified table name in
the -t option of pg_dump, but that apparently is not possible currently.

I tried also using pg_restore to generate a list file, thinking I could
edit the output list file to include only the tables from desired schema.
This would really be a better approach than what I've show above, but
having the duplicate table names was again the problem because nothing in
the list file distinquishes which schema the tables are members of.

~Berend Tober

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rod Taylor 2003-11-07 13:58:07 Re: DDL for a single schema
Previous Message Shridhar Daithankar 2003-11-07 13:12:30 Re: Changing the buffer size