Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 470B2475AEC for ; Fri, 1 Nov 2002 18:57:28 -0500 (EST) Received: from ECIEXCHANGE.ecinet.com (smtp.eldocomp.com [205.159.99.4]) by postgresql.org (Postfix) with ESMTP id BE0BE475ADD for ; Fri, 1 Nov 2002 18:57:27 -0500 (EST) Received: from NWALKER (nwalker.ecinet.com [172.20.144.110]) by ECIEXCHANGE.ecinet.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id WAC4HNA2; Fri, 1 Nov 2002 16:57:11 -0700 Message-Id: <4.2.2.20021101165030.01dcbc70@imap.eldocomp.com> X-Sender: nwalke@imap.eldocomp.com X-Mailer: QUALCOMM Windows Eudora Pro Version 4.2.2 Date: Fri, 01 Nov 2002 16:57:42 -0700 To: Bhuvan A , pgsql-admin@postgresql.org From: Naomi Walker Subject: Re: loading and unloading rows In-Reply-To: References: <4.2.2.20021031172442.01d1fdf0@imap.eldocomp.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200211/32 X-Sequence-Number: 6220 > >It is possible. Delimiters can be used while restoring the data file. >Null string specification can also be specified. See, >test_db=> \h COPY >for more details. The problem with COPY, I think, is that I cannot use a WHERE statement. I'd like to just unload certain rows from a table. If I wanted the whole table, i'll do a pg_dump or copy. >In addition you should also do some find and replace in the data file >before restoring it to another database. They are, >s/\s*|\s*//g >s/^\s*//g Yes, sed is a fine tool, but this seems like such a fundamental need, i'm surprised there is not better method. Again, i'd like a way to easily unload some selected rows (select * table where foo=X) from a table, and save them, or load them in another cluster, etc. Short of writing them to a temp table, then pg_dumping, or some klunk-oid mething, I do not see a clean way. Back to the maddening crowd. Anyone at least agreed this is needed? Could we add "where" clauses to COPY? That would be perfect. ---------------------------------------------------------------------------- ---------------------------------- Naomi Walker Eldorado Computing, Inc Chief Information Officer nwalker@eldocomp.com 602-604-3100 x242