Re: how to use pg_dump to dump tables whose owner is me

From: "A(dot) Rich" <adam(dot)r(at)sbcglobal(dot)net>
To: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>, Roger Chen <roger(dot)edchen(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: how to use pg_dump to dump tables whose owner is me
Date: 2009-03-03 15:39:54
Message-ID: 518540.40996.qm@web81405.mail.mud.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


--- On Tue, 3/3/09, Roger Chen <roger(dot)edchen(at)gmail(dot)com> wrote:

> >> Hi,
> >> Can anyone tell me how to do that? I could find
> that in man page of
> >> pg_dump. Thanks.
> >
> > pg_dump -t table1 -t table2
> >

> Thanks. If there are many tables owned by me and some other
> users, are
> there any easy ways to do that?
>

I would use psql to query all the tables you own to a file,
using a query like this:

select schemaname || '.' || tablename as to_dump
from pg_tables
where tableowner = 'myuser'

And then use xargs to or similar text tools to generate the pg_dump
command you need.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2009-03-03 15:48:08 Re: postgreSQL & amazon ec2 cloud
Previous Message John DeSoi 2009-03-03 15:36:53 Re: grant everything on everything and then revoke