From: | Richard Huxton <dev(at)archonet(dot)com> |
---|---|
To: | Dan Armbrust <daniel(dot)armbrust(dot)list(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: fine tuned database dump/reload? |
Date: | 2005-10-11 18:51:13 |
Message-ID: | 434C09A1.3070103@archonet.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Dan Armbrust wrote:
>
> Is there a better way to do this? Is there a flag I could specify for
> psql that would cause it to output INSERT or COPY statements as a result
> of a query - select * from foo where terminologyId=foo? Then I could
> just have 15 select statements batched up in a file, and pipe the output
> into a new file.
It's easy enough to get psql to output tab-separated columns to a file
from its query (see the various backslash formatting commands and \o).
Spit out the 15 different files you want to /tmp, then use a script with
COPY ... FROM /tmp/file1 etc.
If you use COPY the files need to be readable by the backend process,
otherwise look into \copy in a psql script.
If it gets much more complicated, I knock up a short Perl script. Others
probably prefer Python or Ruby.
--
Richard Huxton
Archonet Ltd
From | Date | Subject | |
---|---|---|---|
Next Message | Scott Marlowe | 2005-10-11 18:59:33 | Re: Considering an upgrade... |
Previous Message | Tony Caduto | 2005-10-11 18:49:51 | Re: Considering an upgrade... |