Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 400CD9FBAB5 for ; Tue, 8 May 2007 01:14:53 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 26961-08 for ; Tue, 8 May 2007 01:14:49 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from weatherbeeta.com.au (218-214-212-153.people.net.au [218.214.212.153]) by postgresql.org (Postfix) with SMTP id 8D2AE9FBAB2 for ; Tue, 8 May 2007 01:14:48 -0300 (ADT) Received: (qmail 6619 invoked from network); 8 May 2007 04:14:46 -0000 X-NetworkBox-HamSign: 0101;OUT;wbeetaau1;f7e971e472a2971cc17d83a5c32fd6d3; Received: from mail.weatherbeeta.com.au (10.10.0.2) by network-box.weatherbeeta.com.au with SMTP; 8 May 2007 04:14:46 -0000 Received: (qmail 28173 invoked by uid 1166); 8 May 2007 14:14:40 +1000 Received: from 172.20.0.155 by mail.weatherbeeta.com.au (envelope-from , uid 1165) with qmail-scanner-1.25-st-qms (clamdscan: 0.88.6/2315. perlscan: 1.25-st-qms. Clear:RC:1(172.20.0.155):. Processed in 0.223765 secs); 08 May 2007 04:14:40 -0000 X-Antivirus-mail.weatherbeeta.com.au-Mail-From: phillip.smith@weatherbeeta.com.au via mail.weatherbeeta.com.au X-Antivirus-mail.weatherbeeta.com.au: 1.25-st-qms (Clear:RC:1(172.20.0.155):. Processed in 0.223765 secs Process 28156) Received: from it-phil.weatherbeeta.com.au (HELO wbaus090) (172.20.0.155) by mail.weatherbeeta.com.au with SMTP; 8 May 2007 14:14:39 +1000 From: "Phillip Smith" To: "'Paul Lambert'" , Subject: Re: Query RE using COPY Date: Tue, 8 May 2007 14:14:49 +1000 Organization: Weatherbeeta Pty Ptd Message-ID: <003b01c79127$6b957ee0$9b0014ac@wbaus090> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.6626 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962 In-Reply-To: <463FE405.40704@autoledgers.com.au> Importance: Normal X-Scanned-By-wbeetaau1: Virus scan performed by network-box X-Scanned-By-wbeetaau1: Scanner file id is wbeetaau1-1178597686.850-6614-000 X-Scanned-By-wbeetaau1: No known viruses found in message (received+scanned in 0.01/0.07 secs) X-Scanned-By-wbeetaau1: Spam-Check-Result: No, hits=0 required=7 tests= autolearn=no version=2.0 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200705/55 X-Sequence-Number: 28336 Can you modify the 'extract' and make the extra column "\n" which is the null escape? That would be the only other option. -----Original Message----- From: pgsql-sql-owner@postgresql.org = [mailto:pgsql-sql-owner@postgresql.org] On Behalf Of Paul Lambert Sent: Tuesday, 8 May 2007 12:44 To: pgsql-sql@postgresql.org Subject: Re: [SQL] Query RE using COPY Jonah H. Harris wrote: > COPY mytbl (col1, col2, col3, col4, col6) FROM 'myfile.txt' WITH > DELIMITER AS '^' QUOTE '\f' CSV HEADER; >=20 >=20 I would rather not do it this way as I use the same load script at all=20 customer sites where the extracts and requirements may vary. I.e. one=20 customer may not use the location field mentioned above, but another = might. What I would prefer to do, if possible, is set that column in the=20 database to 'not required' so that if I get an extract that doesn't have = that column in the file, the copy doesn't care. As it stands now I generally have to drop all the unneeded columns from=20 numerous tables, perform my load and then re-add them back again. When we're talking about 40 or more tables in each database some tables=20 with several hundred columns... your suggestion would be a bit=20 cumbersome - particularly if it is only one or two columns in each table = that that the client doesn't need. --=20 Paul Lambert Database Administrator AutoLedgers ---------------------------(end of broadcast)--------------------------- TIP 6: explain analyze is your friend *******************Confidentiality and Privilege Notice******************* The material contained in this message is privileged and confidential to the addressee. If you are not the addressee indicated in this message or responsible for delivery of the message to such person, you may not copy or deliver this message to anyone, and you should destroy it and kindly notify the sender by reply email. Information in this message that does not relate to the official business of Weatherbeeta must be treated as neither given nor endorsed by Weatherbeeta. Weatherbeeta, its employees, contractors or associates shall not be liable for direct, indirect or consequential loss arising from transmission of this message or any attachments