Обсуждение: how to use pg_dump to dump tables whose owner is me
Hi, Can anyone tell me how to do that? I could find that in man page of pg_dump. Thanks. Best, Roger
On Mon, Mar 2, 2009 at 5:31 PM, Roger Chen <roger.edchen@gmail.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? On Mon, Mar 2, 2009 at 9:23 PM, Scott Marlowe <scott.marlowe@gmail.com> wrote: > On Mon, Mar 2, 2009 at 5:31 PM, Roger Chen <roger.edchen@gmail.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 > > ? >
--- On Tue, 3/3/09, Roger Chen <roger.edchen@gmail.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.
I'd put them all into the same schema and dump that. pg_dump -n schemaname On Tue, Mar 3, 2009 at 8:30 AM, Roger Chen <roger.edchen@gmail.com> wrote: > Thanks. If there are many tables owned by me and some other users, are > there any easy ways to do that? > > On Mon, Mar 2, 2009 at 9:23 PM, Scott Marlowe <scott.marlowe@gmail.com> wrote: >> On Mon, Mar 2, 2009 at 5:31 PM, Roger Chen <roger.edchen@gmail.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 >> >> ? >> > -- When fascism comes to America, it will be the intolerant selling it as diversity.