Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 42DB99FB823 for ; Mon, 19 Mar 2007 23:53:17 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-new, port 10024) with ESMTP id 26319-02 for ; Mon, 19 Mar 2007 23:52:59 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from wx-out-0506.google.com (wx-out-0506.google.com [66.249.82.234]) by postgresql.org (Postfix) with ESMTP id 512199FB7DD for ; Mon, 19 Mar 2007 23:53:06 -0300 (ADT) Received: by wx-out-0506.google.com with SMTP id i28so1570552wxd for ; Mon, 19 Mar 2007 19:53:05 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=cl1U+2Qs1d0n0g2mkuy0g/Ic06PW1K9VjiU6jnOqwyJkNPn0rlk5UnqcRQF+KH9X6iWbiWY/re+CIsB/yNEFL3wGxBIXVSK0FyfetYcuMNtonzXYuiL5Jn6XMpUCsL4eP2pwAL0yoWPnBME5CmIAl6ycFC3rVVreKjrLNvU//6o= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=MVXMMy2IkRFmx7j09rB9IWkLpqzxzs7xOqY3D3j3lHXpXE1vKSqjlut7KvDFWcARCkwt4uLFYPQmRuDMGa5Euty3rjQNNk21BlAusfhtFgBoxaNKZw6Nfosi8CI1jyxZfHJz3UOiunAXLx+LTxgByo8tNACNYXJ7mKggJ9CRags= Received: by 10.90.69.8 with SMTP id r8mr44920aga.1174359184853; Mon, 19 Mar 2007 19:53:04 -0700 (PDT) Received: by 10.90.113.6 with HTTP; Mon, 19 Mar 2007 19:53:04 -0700 (PDT) Message-ID: Date: Tue, 20 Mar 2007 14:53:04 +1200 From: "Andrej Ricnik-Bay" To: "Paul Lambert" Subject: Re: Issue with copying data from a text file. Cc: "Phillip Smith" , pgsql-sql@postgresql.org In-Reply-To: <45FF4AA3.4060808@autoledgers.com.au> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <45FF4622.2010404@autoledgers.com.au> <1174358236.10466.14.camel@it-laptop> <45FF4AA3.4060808@autoledgers.com.au> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200703/259 X-Sequence-Number: 27897 On 3/20/07, Paul Lambert wrote: > The source file comes from extracts on our main application which sits > inside an in-house pretending-to-be-a-dbms file system. The content of > these extracts would be difficult to change - the extract program would > need to parse the data looking for quotes and preceed them with the > necessary escape character. > > Not being a proper database dump it's not a simple matter of flicking a > switch to get it to include the escape character. The way the extracts > are written would require a few dozen lines of code to each extract, and > theres about 40ish extracts. > > Plus I don't maintain that side of our code, and those that do can be a > bit lazy and I'd likely be waiting months to get it done - if they even > decide to do it. Pipe it through sed and replace the Carets with TABS? sed 's/^/\t/g' c:/temp/autodrs_deal_lines.txt > c:/temp/autodrs_deal_lines.tab Then use copy like so: \copy table from 'c:/temp/autodrs_deal_lines.tab' delimiter E'\t' null '' Cheers, Andrej