| From: | "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com> |
|---|---|
| To: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: selective export for subsequent import (COPY) |
| Date: | 2007-04-19 05:27:55 |
| Message-ID: | 20070419052755.GD17172@a-kretschmer.de |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
am Wed, dem 18.04.2007, um 21:59:35 -0700 mailte chrisj folgendes:
>
> I would like to do a selective export of a number of tables from a large
> database to import into a smaller (test) DB.
>
> I know about: psql dbname -tc "select * from tableX where whatever" >
> tableX.dat
>
> but unless I put it through a sed script, this file cannot be easily used
> for import.
>
> It feels like I am re-inventing the wheel. Does anybody know a better way
> or have a good sed script.
If you have 8.2, than you can use COPY also for VIEWs or for SELECTS.
If not, create a temp. table as result for your SELECT and COPY this
temp. table instead the original table.
Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Harvey, Allan AC | 2007-04-19 05:55:50 | Re: selective export for subsequent import (COPY) |
| Previous Message | A. Kretschmer | 2007-04-19 05:01:40 | Re: Login to Postgres 8.2 via Cygwin hangs |